summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-03-19 12:35:25 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-03-19 12:35:25 +0000
commit50b00028bd207f461d6ed02f7868eccb5c6b8fe1 (patch)
tree003311f94f815dddbc39f91ba25b959f6ef18524
parent63f0f49bde74f02cdfc79140a7f101173f33322b (diff)
downloadwordpress-mu-50b00028bd207f461d6ed02f7868eccb5c6b8fe1.tar.gz
wordpress-mu-50b00028bd207f461d6ed02f7868eccb5c6b8fe1.tar.xz
wordpress-mu-50b00028bd207f461d6ed02f7868eccb5c6b8fe1.zip
Add and delete WP 2.5 files. *DON'T SVN UPDATE!*
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1214 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/async-upload.php32
-rw-r--r--wp-admin/css/colors-classic.css701
-rw-r--r--wp-admin/css/colors-fresh.css681
-rw-r--r--wp-admin/css/dashboard.css283
-rw-r--r--wp-admin/css/global.css126
-rw-r--r--wp-admin/css/ie.css58
-rw-r--r--wp-admin/css/login.css74
-rw-r--r--wp-admin/css/media.css238
-rw-r--r--wp-admin/css/theme-editor.css44
-rw-r--r--wp-admin/css/upload-rtl.css12
-rw-r--r--wp-admin/css/upload.css204
-rw-r--r--wp-admin/edit-attachment-rows.php138
-rw-r--r--wp-admin/edit-tag-form.php41
-rw-r--r--wp-admin/edit-tags.php202
-rw-r--r--wp-admin/images/align-center.pngbin0 -> 571 bytes
-rw-r--r--wp-admin/images/align-left.pngbin0 -> 587 bytes
-rw-r--r--wp-admin/images/align-none.pngbin0 -> 453 bytes
-rw-r--r--wp-admin/images/align-right.pngbin0 -> 556 bytes
-rw-r--r--wp-admin/images/box-bg-left.gifbin37 -> 0 bytes
-rw-r--r--wp-admin/images/box-bg-right.gifbin151 -> 0 bytes
-rw-r--r--wp-admin/images/box-bg.gifbin111 -> 0 bytes
-rw-r--r--wp-admin/images/box-butt-left.gifbin169 -> 0 bytes
-rw-r--r--wp-admin/images/box-butt-right.gifbin960 -> 0 bytes
-rw-r--r--wp-admin/images/box-butt.gifbin347 -> 0 bytes
-rw-r--r--wp-admin/images/box-head-left.gifbin334 -> 0 bytes
-rw-r--r--wp-admin/images/box-head-right.gifbin3609 -> 0 bytes
-rw-r--r--wp-admin/images/box-head.gifbin879 -> 0 bytes
-rw-r--r--wp-admin/images/bubble_bg.gifbin0 -> 206 bytes
-rw-r--r--wp-admin/images/comment-grey-bubble.pngbin0 -> 158 bytes
-rw-r--r--wp-admin/images/comment-pill.gifbin0 -> 72 bytes
-rw-r--r--wp-admin/images/comment-stalk-classic.gifbin0 -> 1100 bytes
-rw-r--r--wp-admin/images/comment-stalk-fresh.gifbin0 -> 1067 bytes
-rw-r--r--wp-admin/images/date-button.gifbin0 -> 111 bytes
-rw-r--r--wp-admin/images/heading-bg.gifbin37 -> 0 bytes
-rw-r--r--wp-admin/images/login-bkg-bottom.gifbin704 -> 0 bytes
-rw-r--r--wp-admin/images/login-bkg-tile.gifbin19279 -> 0 bytes
-rw-r--r--wp-admin/images/logo-login.gifbin0 -> 3184 bytes
-rw-r--r--wp-admin/images/media-button-gallery.gifbin0 -> 72 bytes
-rw-r--r--wp-admin/images/media-button-image.gifbin0 -> 69 bytes
-rw-r--r--wp-admin/images/media-button-music.gifbin0 -> 188 bytes
-rw-r--r--wp-admin/images/media-button-other.gifbin0 -> 141 bytes
-rw-r--r--wp-admin/images/media-button-video.gifbin0 -> 68 bytes
-rw-r--r--wp-admin/images/media-buttons.gifbin0 -> 723 bytes
-rw-r--r--wp-admin/images/notice.gifbin156 -> 0 bytes
-rw-r--r--wp-admin/images/tail.gifbin0 -> 98 bytes
-rw-r--r--wp-admin/images/toggle-arrow.gifbin0 -> 71 bytes
-rw-r--r--wp-admin/images/toggle.gifbin216 -> 0 bytes
-rw-r--r--wp-admin/images/xit.gifbin0 -> 181 bytes
-rw-r--r--wp-admin/includes/class-ftp-pure.php175
-rw-r--r--wp-admin/includes/class-ftp-sockets.php236
-rw-r--r--wp-admin/includes/class-ftp.php842
-rw-r--r--wp-admin/includes/class-pclzip.php5748
-rw-r--r--wp-admin/includes/class-wp-filesystem-direct.php336
-rw-r--r--wp-admin/includes/class-wp-filesystem-ftpext.php480
-rw-r--r--wp-admin/includes/class-wp-filesystem-ftpsockets.php426
-rw-r--r--wp-admin/includes/dashboard.php538
-rw-r--r--wp-admin/includes/export.php255
-rw-r--r--wp-admin/includes/media.php1225
-rw-r--r--wp-admin/includes/widgets.php269
-rw-r--r--wp-admin/js/comment.js12
-rw-r--r--wp-admin/js/common.js12
-rw-r--r--wp-admin/js/dbx-admin-key.js47
-rw-r--r--wp-admin/js/editor.js153
-rw-r--r--wp-admin/js/forms.js31
-rw-r--r--wp-admin/js/link-cat.js10
-rw-r--r--wp-admin/js/link.js48
-rw-r--r--wp-admin/js/media-upload.js12
-rw-r--r--wp-admin/js/page.js16
-rw-r--r--wp-admin/js/password-strength-meter.js162
-rw-r--r--wp-admin/js/post.js157
-rw-r--r--wp-admin/js/postbox.js14
-rw-r--r--wp-admin/js/slug.js48
-rw-r--r--wp-admin/js/tags.js21
-rw-r--r--wp-admin/js/widgets.js136
-rw-r--r--wp-admin/media-upload.php41
-rw-r--r--wp-admin/media.php87
-rw-r--r--wp-admin/update.php127
-rw-r--r--wp-admin/wpmu-blogs.php.rej1224
-rw-r--r--wp-content/themes/default/image.php (renamed from wp-content/themes/default/attachment.php)26
-rw-r--r--wp-includes/class-phpass.php256
-rw-r--r--wp-includes/images/audio.pngbin0 -> 574 bytes
-rw-r--r--wp-includes/images/crystal/archive.pngbin0 -> 3066 bytes
-rw-r--r--wp-includes/images/crystal/audio.pngbin0 -> 2647 bytes
-rw-r--r--wp-includes/images/crystal/code.pngbin0 -> 2133 bytes
-rw-r--r--wp-includes/images/crystal/default.pngbin0 -> 638 bytes
-rw-r--r--wp-includes/images/crystal/document.pngbin0 -> 2305 bytes
-rw-r--r--wp-includes/images/crystal/interactive.pngbin0 -> 2808 bytes
-rw-r--r--wp-includes/images/crystal/license.txt9
-rw-r--r--wp-includes/images/crystal/spreadsheet.pngbin0 -> 2725 bytes
-rw-r--r--wp-includes/images/crystal/text.pngbin0 -> 999 bytes
-rw-r--r--wp-includes/images/crystal/video.pngbin0 -> 2372 bytes
-rw-r--r--wp-includes/images/css.pngbin0 -> 533 bytes
-rw-r--r--wp-includes/images/default.pngbin0 -> 479 bytes
-rw-r--r--wp-includes/images/doc.pngbin0 -> 1535 bytes
-rw-r--r--wp-includes/images/exe.pngbin0 -> 194 bytes
-rw-r--r--wp-includes/images/html.pngbin0 -> 537 bytes
-rw-r--r--wp-includes/images/js.pngbin0 -> 517 bytes
-rw-r--r--wp-includes/images/pdf.pngbin0 -> 1424 bytes
-rw-r--r--wp-includes/images/swf.pngbin0 -> 1542 bytes
-rw-r--r--wp-includes/images/tar.pngbin0 -> 1280 bytes
-rw-r--r--wp-includes/images/text.pngbin0 -> 1559 bytes
-rw-r--r--wp-includes/images/video.pngbin0 -> 596 bytes
-rw-r--r--wp-includes/images/zip.pngbin0 -> 1270 bytes
-rw-r--r--wp-includes/js/dbx.js6
-rw-r--r--wp-includes/js/fat.js90
-rw-r--r--wp-includes/js/jquery/jquery.color.js128
-rw-r--r--wp-includes/js/jquery/jquery.dimensions.min.js12
-rw-r--r--wp-includes/js/jquery/jquery.schedule.js36
-rw-r--r--wp-includes/js/jquery/suggest.js310
-rw-r--r--wp-includes/js/jquery/ui.tabs.js529
-rw-r--r--wp-includes/js/list-manipulation.js295
-rw-r--r--wp-includes/js/swfupload/handlers.js227
-rw-r--r--wp-includes/js/swfupload/plugins/swfupload.cookies.js50
-rw-r--r--wp-includes/js/swfupload/plugins/swfupload.documentready.js102
-rw-r--r--wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js63
-rw-r--r--wp-includes/js/swfupload/plugins/swfupload.queue.js58
-rw-r--r--wp-includes/js/swfupload/swfupload.js1051
-rw-r--r--wp-includes/js/swfupload/swfupload_f9.swfbin0 -> 9109 bytes
-rw-r--r--wp-includes/js/thickbox/loadingAnimation.gifbin0 -> 5886 bytes
-rw-r--r--wp-includes/js/thickbox/tb-close.pngbin0 -> 506 bytes
-rw-r--r--wp-includes/js/thickbox/thickbox.css159
-rw-r--r--wp-includes/js/thickbox/thickbox.js320
-rw-r--r--wp-includes/js/tinymce/langs/en.js41
-rw-r--r--wp-includes/js/tinymce/langs/wp-langs.php400
-rw-r--r--wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js30
-rw-r--r--wp-includes/js/tinymce/plugins/autosave/langs/en.js5
-rw-r--r--wp-includes/js/tinymce/plugins/directionality/images/ltr.gifbin155 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/directionality/images/rtl.gifbin153 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/directionality/langs/en.js6
-rw-r--r--wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js1
-rw-r--r--wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm111
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css69
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gifbin43 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gifbin110 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gifbin111 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gifbin112 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gifbin74 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js453
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gifbin0 -> 818 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gifbin0 -> 280 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gifbin0 -> 989 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gifbin0 -> 915 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gifbin0 -> 911 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gifbin0 -> 57 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gifbin0 -> 769 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gifbin0 -> 92 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css125
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/template.htm387
-rw-r--r--wp-includes/js/tinymce/plugins/media/css/content.css6
-rw-r--r--wp-includes/js/tinymce/plugins/media/css/media.css68
-rw-r--r--wp-includes/js/tinymce/plugins/media/editor_plugin.js1
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/flash.gifbin0 -> 241 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/flv_player.swfbin0 -> 11668 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/quicktime.gifbin0 -> 303 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/realmedia.gifbin0 -> 439 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/shockwave.gifbin0 -> 387 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/trans.gif (renamed from wp-includes/js/tinymce/themes/advanced/images/spacer.gif)bin43 -> 43 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/img/windowsmedia.gifbin0 -> 415 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/media/js/embed.js73
-rw-r--r--wp-includes/js/tinymce/plugins/media/js/media.js621
-rw-r--r--wp-includes/js/tinymce/plugins/media/media.htm824
-rw-r--r--wp-includes/js/tinymce/plugins/paste/images/pastetext.gifbin294 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/paste/images/pasteword.gifbin299 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/paste/images/selectall.gifbin205 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/paste/js/pastetext.js (renamed from wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js)80
-rw-r--r--wp-includes/js/tinymce/plugins/paste/js/pasteword.js (renamed from wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js)108
-rw-r--r--wp-includes/js/tinymce/plugins/paste/langs/en.js10
-rw-r--r--wp-includes/js/tinymce/plugins/safari/blank.htm1
-rw-r--r--wp-includes/js/tinymce/plugins/safari/editor_plugin.js1
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php158
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php339
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php81
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php112
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php61
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php126
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php64
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php121
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php595
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php268
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css35
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gifbin591 -> 0 bytes
-rw-r--r--[-rwxr-xr-x]wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif (renamed from wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif)bin46 -> 46 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/includes/general.php98
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/langs/en.js15
-rw-r--r--wp-includes/js/tinymce/plugins/spellchecker/rpc.php75
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/tinyspell.php164
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/css/content.css15
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/img/help.gif (renamed from wp-includes/js/tinymce/plugins/wordpress/images/help.gif)bin295 -> 295 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/img/more.gif (renamed from wp-includes/js/tinymce/plugins/wordpress/images/more.gif)bin108 -> 108 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif (renamed from wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif)bin146 -> 146 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/img/page.gif (renamed from wp-includes/js/tinymce/plugins/wordpress/images/page.gif)bin108 -> 108 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif (renamed from wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif)bin180 -> 180 bytes
-rw-r--r--[-rwxr-xr-x]wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif (renamed from wp-includes/js/tinymce/plugins/wordpress/images/toolbars.gif)bin260 -> 260 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/img/trans.gifbin0 -> 43 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/langs/en.js37
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/wordpress.css81
-rw-r--r--wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js57
-rw-r--r--wp-includes/js/tinymce/plugins/wphelp/images/help.gifbin295 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/plugins/wphelp/langs/en.js5
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/colorpicker.css53
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/editor_content.css58
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/editor_popup.css358
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/editor_ui.css97
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/anchor.gifbin171 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/backcolor.gifbin359 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bold.gifbin76 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bold_de_se.gifbin73 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bold_es.gifbin80 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bold_fr.gifbin78 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bold_ru.gifbin77 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bold_tw.gifbin207 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/browse.gifbin113 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/bullist.gifbin108 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/button_menu.gifbin57 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/buttons.gifbin5662 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/cancel_button_bg.gifbin677 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/center.gifbin70 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/charmap.gifbin245 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/cleanup.gifbin256 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/close.gifbin102 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/code.gifbin110 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/color.gifbin125 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/copy.gifbin263 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/custom_1.gifbin76 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/cut.gifbin187 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/forecolor.gifbin342 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/full.gifbin71 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/help.gifbin295 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/hr.gifbin63 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/image.gifbin194 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/indent.gifbin112 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/insert_button_bg.gifbin703 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/italic.gifbin79 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/italic_de_se.gifbin75 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/italic_es.gifbin74 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/italic_ru.gifbin78 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/italic_tw.gifbin274 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/justifycenter.gifbin70 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/justifyfull.gifbin71 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/justifyleft.gifbin71 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/justifyright.gifbin70 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/left.gifbin71 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/link.gifbin175 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/menu_check.gifbin51 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/newdocument.gifbin170 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/numlist.gifbin111 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/opacity.pngbin147 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/outdent.gifbin110 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/paste.gifbin286 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/redo.gifbin169 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/removeformat.gifbin168 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/right.gifbin70 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/statusbar_resize.gifbin79 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/strikethrough.gifbin83 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/sub.gifbin148 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/sup.gifbin147 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table.gifbin287 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table_delete_col.gifbin163 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table_delete_row.gifbin171 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table_insert_col_after.gifbin165 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table_insert_col_before.gifbin165 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table_insert_row_after.gifbin163 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/table_insert_row_before.gifbin159 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/underline.gifbin88 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/underline_es.gifbin79 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/underline_fr.gifbin79 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/underline_ru.gifbin77 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/underline_tw.gifbin245 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/undo.gifbin175 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/unlink.gifbin190 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/visualaid.gifbin206 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/xp/tab_bg.gifbin694 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/xp/tab_end.gifbin169 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_bg.gifbin428 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_end.gifbin101 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/xp/tabs_bg.gifbin48 -> 0 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg (renamed from wp-includes/js/tinymce/themes/advanced/images/colors.jpg)bin3189 -> 3189 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/img/fm.gifbin0 -> 1805 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/img/gotmoxie.pngbin0 -> 983 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/img/icons.gifbin0 -> 11532 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/img/sflogo.pngbin0 -> 469 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/about.js72
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/anchor.js33
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/charmap.js (renamed from wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js)33
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/color_picker.js (renamed from wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js)29
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/image.js254
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/link.js126
-rw-r--r--wp-includes/js/tinymce/themes/advanced/js/source_editor.js (renamed from wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js)33
-rw-r--r--wp-includes/js/tinymce/themes/advanced/jscripts/about.js75
-rw-r--r--wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js74
-rw-r--r--wp-includes/js/tinymce/themes/advanced/jscripts/image.js81
-rw-r--r--wp-includes/js/tinymce/themes/advanced/jscripts/link.js82
-rw-r--r--wp-includes/js/tinymce/themes/advanced/langs/en.js93
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/content.css25
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css114
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.pngbin0 -> 3274 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif (renamed from wp-includes/js/tinymce/themes/advanced/images/anchor_symbol.gif)bin70 -> 70 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gifbin0 -> 68 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gifbin0 -> 70 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gifbin0 -> 1787 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gifbin0 -> 1326 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/default/ui.css210
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css25
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css113
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.pngbin0 -> 5859 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.pngbin0 -> 3736 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.pngbin0 -> 5358 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css211
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css8
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css5
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css19
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css119
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.pngbin0 -> 545 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.pngbin0 -> 5859 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gifbin0 -> 60 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.pngbin0 -> 785 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif (renamed from wp-includes/js/tinymce/themes/advanced/images/separator.gif)bin57 -> 57 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gifbin0 -> 1326 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css370
-rw-r--r--wp-includes/js/tinymce/tiny_mce_ext.js29
-rw-r--r--wp-includes/js/tinymce/wordpress.css29
-rw-r--r--wp-includes/js/wp-ajax-response.js57
-rw-r--r--wp-includes/js/wp-lists.js369
-rw-r--r--wp-includes/media.php404
-rw-r--r--wp-includes/shortcodes.php133
325 files changed, 25726 insertions, 3442 deletions
diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php
new file mode 100644
index 0000000..c6350aa
--- /dev/null
+++ b/wp-admin/async-upload.php
@@ -0,0 +1,32 @@
+<?php
+
+/* This accepts file uploads from swfupload or other asynchronous upload methods.
+
+*/
+
+if ( defined('ABSPATH') )
+ require_once( ABSPATH . 'wp-config.php');
+else
+ require_once('../wp-config.php');
+
+// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
+if ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+ $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+unset($current_user);
+require_once('admin.php');
+
+header('Content-Type: text/plain');
+
+if ( !current_user_can('upload_files') )
+ wp_die(__('You do not have permission to upload files.'));
+
+$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+if (is_wp_error($id)) {
+ echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
+ exit;
+}
+
+$type = $_REQUEST['type'];
+echo apply_filters("async_upload_{$type}", $id);
+
+?>
diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css
new file mode 100644
index 0000000..4251f15
--- /dev/null
+++ b/wp-admin/css/colors-classic.css
@@ -0,0 +1,701 @@
+a.page-numbers:hover {
+ border-color: #999;
+}
+
+body {
+ background-color: #fff;
+ color: #333;
+}
+
+body > #upload-menu {
+ border-bottom-style: #fff;
+}
+
+div#current-widgets, #postcustomstuff table, #your-profile fieldset, a.page-numbers, #rightnow, div.dashboard-widget, .widefat {
+ border-color: #ccc;
+}
+
+div.dashboard-widget-error {
+ background-color: #c43;
+}
+
+div.dashboard-widget-notice {
+ background-color: #F0F6FB;
+}
+
+div.dashboard-widget-submit, ul.widget-control-list div.widget-control-actions {
+ border-top-color: #ccc;
+}
+
+input.disabled, textarea.disabled {
+ background-color: #ccc;
+}
+
+li.widget-list-control-item h4.widget-title a:hover, .submit a, #user_info a, #dashmenu a:hover, #footer a, #upload-menu li a.upload-tab-link, li.widget-list-control-item h4.widget-title a,
+#dragHelper li.widget-list-control-item h4.widget-title a,
+#draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover {
+ color: #fff;
+}
+
+ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+ background-color: #cfebf7;
+}
+
+div.ui-tabs-panel {
+ border-color: #cfebf7;
+}
+
+select {
+ background-color: #fff;
+ border-color: #ddd;
+}
+
+strong .post-com-count span {
+ background-color: #2583ad;
+}
+
+.button-secondary, #quicktags, #login form .submit input {
+ background-color: #83b4d5 !important;
+}
+
+ul#widget-list li.widget-list-item h4.widget-title {
+ background-color: #f0f0f0;
+ color: #000;
+}
+
+ul.widget-control-list .sorthelper {
+ background-color: #ccf3fa;
+}
+
+.ac_match, .subsubsub a.current, h2 {
+ color: #000;
+}
+
+.ac_over {
+ background-color: #f0f0b8;
+}
+
+.ac_results {
+ background-color: #fff;
+ border-color: #808080;
+}
+
+.ac_results li {
+ color: #101010;
+}
+
+.alternate {
+ background-color: #f9f9f9;
+}
+
+.available-theme a.screenshot {
+ background-color: #f1f1f1;
+ border-color: #ccc;
+}
+
+.bar {
+ background-color: #e8e8e8;
+ border-right-color: #99d;
+}
+
+.describe {
+ border-top-color: #d0d0d0;
+}
+
+.error, #login #login_error {
+ background-color: #ffebe8;
+ border-color: #c00;
+}
+
+.error a {
+ color: #c00;
+}
+
+.form-invalid {
+ background-color: #ffebe8 !important;
+}
+
+.form-invalid input {
+ border-color: #c00 !important;
+}
+
+.form-table input, .form-table textarea {
+ border-color: #c6d9e9;
+}
+
+.form-table td, .form-table th {
+ border-bottom-color: #fff;
+}
+
+.highlight {
+ background-color: #cfebf7;
+ color: #d54e21;
+}
+
+.howto, .nonessential, #sidemenu, #edit-slug-box, .form-input-tip, #dashboard_primary span.rss-date, .subsubsub, #dashboard_secondary div.dashboard-widget-content ul li a cite {
+ color: #999;
+}
+
+#dashmenu a {
+ color: #88b4d7;
+}
+
+.media-item {
+ border-bottom-color: #d0d0d0;
+}
+
+.media-upload-form label.form-help, td.help {
+ color: #9a9a9a;
+}
+
+.page-numbers {
+ background-color: #fff;
+ border-color: #fff;
+}
+
+.page-numbers.current {
+ background-color: #328ab2;
+ border-color: #328ab2;
+ color: #fff;
+}
+
+.post-com-count {
+ background-image: url(../images/bubble_bg.gif);
+ color: #fff;
+}
+
+.post-com-count span {
+ background-color: #bbb;
+ color: #fff;
+}
+
+.post-com-count:hover span {
+ background-color: #d54e21;
+}
+
+.quicktags, .search {
+ background-color: #ccc;
+ color: #000;
+}
+
+.side-info h5, .bordertitle {
+ border-bottom-color: #dadada;
+}
+
+.side-info ul {
+ color: #666;
+}
+
+.submit input, .button, .button-secondary, #login form .submit input, div.dashboard-widget-submit input {
+ background-color: #e5e5e5;
+ color: #246;
+ border-color: #a3a3a3;
+}
+
+.tablenav .button-secondary {
+ border-color: #5396c5;
+}
+
+.submit input:hover, .button:hover {
+ border-color: #535353;
+}
+
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover {
+ color: #d54e21;
+}
+
+.button-secondary:hover, #login form .submit input:hover {
+ border-color: #328ab2;
+}
+
+.submitbox #autosave .error, ul.view-switch li.current a {
+ color: #333;
+}
+
+.submitbox #previewview {
+ background-color: #5488af;
+}
+
+.submitbox #previewview a, #rightnow .rbutton {
+ background-color: #ebebeb;
+ color: #264761;
+}
+
+.submitbox .submit {
+ background-color: #464646;
+ color: #ccc;
+}
+
+.submitbox .submitdelete {
+ border-bottom-color: #999;
+}
+
+.submitbox .submitdelete:hover {
+ color: #fff;
+ background-color: #f00;
+ border-bottom-color: #f00;
+}
+
+.tablenav .dots {
+ background-color: #cfebf7;
+ border-color: #cfebf7;
+}
+
+.tablenav .next, .tablenav .prev{
+ background-color: #cfebf7;
+ border-bottom-color: #cfebf7;
+ border-color: #cfebf7;
+ color: #2583ad;
+}
+
+.tablenav .next:hover, .tablenav .prev:hover {
+ border-bottom-color: #d54e21;
+ border-color: #cfebf7;
+ color: #d54e21;
+}
+
+.updated, .login #login_error, .login .message {
+ background-color: #ffffe0;
+ border-color: #e6db55;
+}
+
+.updated a {
+ border-bottom-color: #2583ad;
+}
+
+.widefat td, .widefat th, div#available-widgets-filter, ul#widget-list li.widget-list-item, .commentlist li {
+ border-bottom-color: #ccc;
+}
+
+.widefat thead, .thead {
+ background-color: #464646;
+ color: #d7d7d7;
+}
+
+.widget-control-save, .widget-control-remove {
+ background-color: #83b4d5;
+ color: #246;
+}
+
+.wrap h2 {
+ border-bottom-color: #dadada;
+ color: #5a5a5a;
+}
+
+#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+ color: #2e7ca0;
+}
+
+#adminmenu a {
+ color: #cfebf6;
+}
+
+#submenu a {
+ color: #2782af
+}
+/* Because we don't want visited on these links */
+#adminmenu a.current, #sidemenu a.current {
+ background-color: #fff;
+ border-color: #c6d9e9;
+ border-bottom-color: #fff;
+ color: #d54e21;
+ font-weight: bold;
+}
+
+#adminmenu li a #awaiting-mod {
+ background-image: url(../images/comment-stalk-classic.gif);
+}
+
+#adminmenu li a #awaiting-mod span {
+ background-color: #d54e21;
+ color: #fff;
+}
+
+#rightnow .reallynow {
+ background-color: #114973;
+ color: #fff;
+}
+
+
+#adminmenu li a:hover #awaiting-mod span {
+ background-color: #07273E;
+}
+
+#adminmenu, div#media-upload-header {
+ background-color: #14568a;
+ border-bottom-color: #c6d9e9;
+}
+
+#currenttheme img {
+ border-color: #666;
+}
+
+#current-widgets .drop-widget-here {
+ background-color: #ffc;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul li a {
+ background-color: #f9f9f9;
+}
+
+input.readonly {
+ background-color: #ddd;
+}
+
+#dashmenu a.current {
+ background-color: #14568a;
+ color: #cfebf6;
+}
+
+#dragHelper h4.widget-title, li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4 {
+ background-color: #2683ae;
+ color: #fff;
+}
+
+#ed_toolbar input {
+ background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
+}
+
+#editable-post-name {
+ background-color: #fffbcc;
+}
+
+#edit-slug-box strong, .login #nav a {
+ color: #777;
+}
+
+#edit-slug-buttons a.save {
+ background-color: #ebebeb;
+}
+
+#footer {
+ background: url(../images/logo-ghost.png) #464646 no-repeat 20px 10px;
+ color: #999;
+}
+
+#media-items {
+ border-color: #c0c0c0;
+}
+
+#pass-strength-result {
+ background-color: #e3e3e3;
+ border-color: #000;
+}
+
+#pass-strength-result.bad {
+ background-color: #ffeff7;
+ border-color: #c69;
+}
+
+#pass-strength-result.good {
+ background-color: #effff4;
+ border-color: #66cc87;
+}
+
+#pass-strength-result.short {
+ background-color: #e3e3e3;
+}
+
+#pass-strength-result.strong {
+ background-color: #59ef86;
+ border-color: #319f52;
+}
+
+#plugins .active, .checkbox, .side-info, #your-profile #rich_editing {
+ background-color: #fff;
+}
+
+#plugins .togl {
+ border-right-color: #ccc;
+}
+
+#plugins tr, #the-comment-list .unapproved {
+ background-color: #f0f0f0;
+}
+
+#poststuff #editor-toolbar .active {
+ background-color: #83b4d5;
+ color: #333;
+}
+
+#poststuff .closed .togbox {
+ background-color: #2583ad;
+ background-image: url(../images/toggle-arrow.gif);
+}
+
+#poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {
+ border-color: #ebebeb;
+ border-right-color: #ccc;
+ border-bottom-color: #ccc;
+}
+
+#poststuff .togbox {
+ background-color: #b2b2b2;
+ background-image: url(../images/toggle-arrow.gif);
+}
+
+#quicktags #ed_link {
+ color: #00f;
+}
+
+#rightnow .youhave {
+ background-color: #f0f6fb;
+}
+
+#rightnow a {
+ color: #448abd;
+}
+
+#sidemenu a {
+ background-color: #14568a;
+ border-bottom-color: #c6d9e9;
+ border-top-color: #14568a;
+ color: #cfebf6;
+}
+
+#tagchecklist span a {
+ background: url(../images/xit.gif) no-repeat;
+}
+
+#tagchecklist span a:hover {
+ background: url(../images/xit.gif) no-repeat -10px 0;
+}
+
+#the-comment-list .comment a {
+ border-bottom-color: #ababab;
+ color: #666;
+}
+
+#update-nag a:link, .plugin-update a:link {
+ color: #036;
+}
+
+#update-nag, .plugin-update {
+ background-color: #fffeeb;
+ border-bottom-color: #ccc;
+ border-top-color: #ccc;
+ color: #cfebf6;
+}
+
+#upload-files a.file-link {
+ background-color: #d1e2ef;
+}
+
+#upload-file-view a img {
+ border-bottom-color: #69c;
+}
+
+#upload-menu li #current-tab-nav, #upload-file {
+ background-color: #f9fcfe;
+}
+
+#upload-menu li span a.page-numbers {
+ color: #00019b;
+}
+
+#upload-menu li.current {
+ border-right-color: #448abd;
+ color: #000;
+}
+
+#upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
+ background-color: #f9fcfe;
+ color: #000;
+}
+
+#upload-menu, #upload-menu li {
+ border-top-color: #247fab;
+}
+
+#user_info, .login #backtoblog a {
+ color: #ccc;
+}
+
+#wphead {
+ background-color: #14568a;
+}
+
+#wphead, body.login {
+ border-top-color: #07273e;
+}
+
+#wphead #viewsite a {
+ background-color: #94acc1;
+ color: white;
+ border-color: #94acc1;
+}
+
+#wphead #viewsite a:hover {
+ color: #246;
+}
+
+#wphead h1, #dashmenu a.current:hover {
+ color: #cfebf6;
+}
+
+div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover, .delete:hover {
+ color: #f00;
+}
+
+#media-upload a.delete {
+ color: #888;
+}
+
+
+/* TinyMCE */
+.wp_themeSkin *,
+.wp_themeSkin a:hover,
+.wp_themeSkin a:link,
+.wp_themeSkin a:visited,
+.wp_themeSkin a:active {
+ color: #000;
+}
+
+/* Containers */
+.wp_themeSkin table {
+ background: #83B4D5;
+}
+
+.wp_themeSkin iframe {
+ background: #fff;
+}
+
+/* Layout */
+.wp_themeSkin .mceStatusbar {
+ color:#000;
+ background-color: #eaf3fa;
+}
+
+/* Button */
+.wp_themeSkin .mceButton {
+ background-color: #e9e8e8;
+ border-color: #83B4D5;
+}
+
+.wp_themeSkin a.mceButtonEnabled:hover,
+.wp_themeSkin a.mceButtonActive,
+.wp_themeSkin a.mceButtonSelected {
+ background-color: #d6d8da;
+ border-color: #7789ba !important;
+}
+
+.wp_themeSkin .mceButtonDisabled {
+ border-color: #83B4D5 !important;
+}
+
+/* ListBox */
+.wp_themeSkin .mceListBox .mceText,
+.wp_themeSkin .mceListBox .mceOpen {
+ border-color: #83B4D5;
+ background-color: #e9e8e8;
+}
+
+.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
+.wp_themeSkin .mceListBoxHover .mceOpen,
+.wp_themeSkin .mceListBoxSelected .mceOpen,
+.wp_themeSkin .mceListBoxSelected .mceText {
+ border-color: #7789ba !important;
+ background-color: #d6d8da;
+}
+
+.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
+.wp_themeSkin .mceListBoxHover .mceText {
+ border-color: #7789ba !important;
+}
+
+.wp_themeSkin select.mceListBox {
+ border-color: #b3c7e1;
+ background-color: #fff;
+}
+
+/* SplitButton */
+.wp_themeSkin .mceSplitButton a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceOpen {
+ background-color: #e9e8e8;
+ border-color: #83B4D5;
+}
+
+.wp_themeSkin .mceSplitButton a.mceOpen:hover,
+.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
+.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceAction:hover {
+ background-color: #d6d8da;
+ border-color: #7789ba !important;
+}
+
+.wp_themeSkin .mceSplitButtonActive {
+ background-color: #d6d8da;
+}
+
+/* ColorSplitButton */
+.wp_themeSkin div.mceColorSplitMenu table {
+ background-color: #ebeaeb;
+ border-color: #808080;
+}
+
+.wp_themeSkin .mceColorSplitMenu a {
+ border-color: #808080;
+}
+
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
+ border-color: #fff;
+}
+
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
+ border-color: #0A246A;
+ background-color: #B6BDD2;
+}
+
+.wp_themeSkin a.mceMoreColors:hover {
+ border-color: #0A246A;
+}
+
+/* Menu */
+.wp_themeSkin .mceMenu {
+ border-color: #ddd;
+}
+
+.wp_themeSkin .mceMenu table {
+ background-color: #ebeaeb;
+}
+
+.wp_themeSkin .mceMenu .mceText {
+ color: #000;
+}
+
+.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
+.wp_themeSkin .mceMenu .mceMenuItemActive {
+ background-color: #83B4D5;
+}
+.wp_themeSkin td.mceMenuItemSeparator {
+ background-color: #aaa;
+}
+.wp_themeSkin .mceMenuItemTitle a {
+ background-color: #ccc;
+ border-bottom-color: #aaa;
+}
+.wp_themeSkin .mceMenuItemTitle span.mceText {
+ color: #000;
+}
+.wp_themeSkin .mceMenuItemDisabled .mceText {
+ color: #888;
+}
+
+/* pop-up */
+.clearlooks2 .mceTop .mceLeft, .clearlooks2 .mceTop .mceRight {
+ background-color: #cee1ef;
+ border-color: #c6d9e9;
+}
+
+.clearlooks2 .mceFocus .mceTop .mceLeft, .clearlooks2 .mceFocus .mceTop .mceRight {
+ background-color: #5488AF;
+ border-color: #464646;
+}
+
+#editorcontainer {
+ border-color: #ccc;
+}
+
+#poststuff #titlewrap {
+ border-color: #ccc;
+}
diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css
new file mode 100644
index 0000000..823ba46
--- /dev/null
+++ b/wp-admin/css/colors-fresh.css
@@ -0,0 +1,681 @@
+a.page-numbers:hover {
+ border-color: #999;
+}
+
+body {
+ background-color: #fff;
+ color: #333;
+}
+
+body > #upload-menu {
+ border-bottom-style: #fff;
+}
+
+div#current-widgets, #postcustomstuff table, #your-profile fieldset, a.page-numbers, #rightnow, div.dashboard-widget, .widefat {
+ border-color: #ccc;
+}
+
+div.dashboard-widget-error {
+ background-color: #c43;
+}
+
+div.dashboard-widget-notice {
+ background-color: #cfe1ef;
+}
+
+div.dashboard-widget-submit, ul.widget-control-list div.widget-control-actions {
+ border-top-color: #ccc;
+}
+
+div.ui-tabs-panel {
+ border-color: #cee1ef;
+}
+
+input.disabled, textarea.disabled {
+ background-color: #ccc;
+}
+
+li.widget-list-control-item h4.widget-title a:hover, .submit a, #user_info a, #dashmenu a:hover, #footer a, #upload-menu li a.upload-tab-link, li.widget-list-control-item h4.widget-title a,
+#dragHelper li.widget-list-control-item h4.widget-title a,
+#draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover {
+ color: #fff;
+}
+
+li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+ background-color: #eaf3fa;
+}
+
+select {
+ background-color: #fff;
+ border-color: #ddd;
+}
+
+strong .post-com-count span {
+ background-color: #2583ad;
+}
+
+ul#category-tabs li.ui-tabs-selected, .button-secondary, #quicktags, #login form .submit input {
+ background-color: #cee1ef !important;
+}
+
+ul#widget-list li.widget-list-item h4.widget-title {
+ background-color: #f0f0f0;
+ color: #000;
+}
+
+ul.widget-control-list .sorthelper {
+ background-color: #ccf3fa;
+}
+
+.ac_match, .subsubsub a.current, h2 {
+ color: #000;
+}
+
+.ac_over {
+ background-color: #f0f0b8;
+}
+
+.ac_results {
+ background-color: #fff;
+ border-color: #808080;
+}
+
+.ac_results li {
+ color: #101010;
+}
+
+.alternate {
+ background-color: #f9f9f9;
+}
+
+.available-theme a.screenshot {
+ background-color: #f1f1f1;
+ border-color: #ccc;
+}
+
+.bar {
+ background-color: #e8e8e8;
+ border-right-color: #99d;
+}
+
+.describe {
+ border-top-color: #d0d0d0;
+}
+
+.error, #login #login_error {
+ background-color: #ffebe8;
+ border-color: #c00;
+}
+
+.error a {
+ color: #c00;
+}
+
+.form-invalid {
+ background-color: #ffebe8 !important;
+}
+
+.form-invalid input {
+ border-color: #c00 !important;
+}
+
+.form-table input, .form-table textarea {
+ border-color: #c6d9e9;
+}
+
+.form-table td, .form-table th {
+ border-bottom-color: #fff;
+}
+
+.highlight {
+ background-color: #e4f2fd;
+ color: #d54e21;
+}
+
+.howto, .nonessential, #dashmenu a, #sidemenu, #edit-slug-box, .form-input-tip, #dashboard_primary span.rss-date, .subsubsub, #dashboard_secondary div.dashboard-widget-content ul li a cite {
+ color: #999;
+}
+
+.media-item {
+ border-bottom-color: #d0d0d0;
+}
+
+.media-upload-form label.form-help, td.help {
+ color: #9a9a9a;
+}
+
+.page-numbers {
+ background-color: #fff;
+ border-color: #fff;
+}
+
+.page-numbers.current {
+ background-color: #328ab2;
+ border-color: #328ab2;
+ color: #fff;
+}
+
+.post-com-count {
+ background-image: url(../images/bubble_bg.gif);
+ color: #fff;
+}
+
+.post-com-count span {
+ background-color: #bbb;
+ color: #fff;
+}
+
+.post-com-count:hover span {
+ background-color: #d54e21;
+}
+
+.quicktags, .search {
+ background-color: #ccc;
+ color: #000;
+}
+
+.side-info h5, .bordertitle {
+ border-bottom-color: #dadada;
+}
+
+.side-info ul {
+ color: #666;
+}
+
+.submit input, .button, .button-secondary, #login form .submit input, div.dashboard-widget-submit input {
+ background-color: #e5e5e5;
+ color: #246;
+ border-color: #a3a3a3;
+}
+
+.submit input:hover, .button:hover {
+ border-color: #535353;
+}
+
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover {
+ color: #d54e21;
+}
+
+.button-secondary:hover, #login form .submit input:hover {
+ border-color: #328ab2;
+}
+
+.submitbox #autosave .error, ul.view-switch li.current a {
+ color: #333;
+}
+
+.submitbox #previewview {
+ background-color: #2683ae;
+}
+
+.submitbox #previewview a, #rightnow .rbutton {
+ background-color: #ebebeb;
+ color: #264761;
+}
+
+.submitbox .submit {
+ background-color: #464646;
+ color: #ccc;
+}
+
+.submitbox .submitdelete {
+ border-bottom-color: #999;
+}
+
+.submitbox .submitdelete:hover {
+ color: #fff;
+ background-color: #f00;
+ border-bottom-color: #f00;
+}
+
+.tablenav .dots {
+ background-color: #e4f2fd;
+ border-color: #e4f2fd;
+}
+
+.tablenav .next, .tablenav .prev{
+ background-color: #e4f2fd;
+ border-bottom-color: #2583ad;
+ border-color: #e4f2fd;
+ color: #2583ad;
+}
+
+.tablenav .next:hover, .tablenav .prev:hover {
+ border-bottom-color: #d54e21;
+ border-color: #e4f2fd;
+ color: #d54e21;
+}
+
+.updated, .login #login_error, .login .message {
+ background-color: #ffffe0;
+ border-color: #e6db55;
+}
+
+.updated a {
+ border-bottom-color: #2583ad;
+}
+
+.widefat td, .widefat th, div#available-widgets-filter, ul#widget-list li.widget-list-item, .commentlist li {
+ border-bottom-color: #ccc;
+}
+
+.widefat thead, .thead {
+ background-color: #464646;
+ color: #d7d7d7;
+}
+
+.widget-control-save, .widget-control-remove {
+ background-color: #cee1ef;
+ color: #246;
+}
+
+.wrap h2 {
+ border-bottom-color: #dadada;
+ color: #666;
+}
+
+#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+ color: #2583ad;
+}
+
+/* Because we don't want visited on these links */
+#adminmenu a.current, #sidemenu a.current {
+ background-color: #fff;
+ border-color: #c6d9e9;
+ border-bottom-color: #fff;
+ color: #d54e21;
+}
+
+#adminmenu li a #awaiting-mod {
+ background-image: url(../images/comment-stalk-fresh.gif);
+}
+
+#adminmenu li a #awaiting-mod span, #rightnow .reallynow {
+ background-color: #d54e21;
+ color: #fff;
+}
+
+#adminmenu li a:hover #awaiting-mod span {
+ background-color: #264761;
+}
+
+#adminmenu, div#media-upload-header {
+ background-color: #e4f2fd;
+ border-bottom-color: #c6d9e9;
+}
+
+#currenttheme img {
+ border-color: #666;
+}
+
+#current-widgets .drop-widget-here {
+ background-color: #ffc;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul li a {
+ background-color: #f9f9f9;
+}
+
+input.readonly {
+ background-color: #ddd;
+}
+
+#dashmenu a.current {
+ background-color: #e4f2fd;
+ color: #555;
+}
+
+#dragHelper h4.widget-title, li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4 {
+ background-color: #2683ae;
+ color: #fff;
+}
+
+#ed_toolbar input {
+ background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
+}
+
+#editable-post-name {
+ background-color: #fffbcc;
+}
+
+#edit-slug-box strong, .login #nav a {
+ color: #777;
+}
+
+#edit-slug-buttons a.save {
+ background-color: #ebebeb;
+}
+
+#footer {
+ background: url(../images/logo-ghost.png) #464646 no-repeat 20px 10px;
+ color: #999;
+}
+
+#media-items {
+ border-color: #c0c0c0;
+}
+
+#pass-strength-result {
+ background-color: #e3e3e3;
+ border-color: #000;
+}
+
+#pass-strength-result.bad {
+ background-color: #ffeff7;
+ border-color: #c69;
+}
+
+#pass-strength-result.good {
+ background-color: #effff4;
+ border-color: #66cc87;
+}
+
+#pass-strength-result.short {
+ background-color: #e3e3e3;
+}
+
+#pass-strength-result.strong {
+ background-color: #59ef86;
+ border-color: #319f52;
+}
+
+#plugins .active, .checkbox, .side-info, #your-profile #rich_editing {
+ background-color: #fff;
+}
+
+#plugins .togl {
+ border-right-color: #ccc;
+}
+
+#plugins tr, #the-comment-list .unapproved {
+ background-color: #f0f0f0;
+}
+
+#poststuff #editor-toolbar .active {
+ background-color: #cee1ef;
+ color: #333;
+}
+
+#poststuff .closed .togbox {
+ background-color: #2583ad;
+ background-image: url(../images/toggle-arrow.gif);
+}
+
+#poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {
+ border-color: #ebebeb;
+ border-right-color: #ccc;
+ border-bottom-color: #ccc;
+}
+
+#poststuff .togbox {
+ background-color: #b2b2b2;
+ background-image: url(../images/toggle-arrow.gif);
+}
+
+#quicktags #ed_link {
+ color: #00f;
+}
+
+#rightnow .youhave {
+ background-color: #f0f6fb;
+}
+
+#rightnow a {
+ color: #448abd;
+}
+
+#sidemenu a {
+ background-color: #e4f2fd;
+ border-bottom-color: #c6d9e9;
+ border-top-color: #e4f2fd;
+}
+
+#tagchecklist span a {
+ background: url(../images/xit.gif) no-repeat;
+}
+
+#tagchecklist span a:hover {
+ background: url(../images/xit.gif) no-repeat -10px 0;
+}
+
+#the-comment-list .comment a {
+ border-bottom-color: #ababab;
+ color: #666;
+}
+
+#update-nag a:link, .plugin-update a:link {
+ color: #036;
+}
+
+#update-nag, .plugin-update {
+ background-color: #fffeeb;
+ border-bottom-color: #ccc;
+ border-top-color: #ccc;
+ color: #555;
+}
+
+#upload-files a.file-link {
+ background-color: #d1e2ef;
+}
+
+#upload-file-view a img {
+ border-bottom-color: #69c;
+}
+
+#upload-menu li #current-tab-nav, #upload-file {
+ background-color: #f9fcfe;
+}
+
+#upload-menu li span a.page-numbers {
+ color: #00019b;
+}
+
+#upload-menu li.current {
+ border-right-color: #448abd;
+ color: #000;
+}
+
+#upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
+ background-color: #f9fcfe;
+ color: #000;
+}
+
+#upload-menu, #upload-menu li {
+ border-top-color: #247fab;
+}
+
+#user_info, .login #backtoblog a, .curtime {
+ color: #ccc;
+}
+
+#wphead {
+ background-color: #e4f2fd;
+}
+
+#wphead, body.login {
+ border-top-color: #464646;
+}
+
+#wphead #viewsite a {
+ background-color: #c6d9e9;
+ color: #246;
+ border-color: #94acc1;
+}
+
+#wphead #viewsite a:hover {
+ border-color: #246;
+}
+
+#wphead h1, #dashmenu a.current:hover, #login form input {
+ color: #555;
+}
+
+div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover, .delete:hover {
+ color: #f00;
+}
+
+#media-upload a.delete {
+ color: #888;
+}
+
+/* TinyMCE */
+.wp_themeSkin *,
+.wp_themeSkin a:hover,
+.wp_themeSkin a:link,
+.wp_themeSkin a:visited,
+.wp_themeSkin a:active {
+ color: #000;
+}
+
+/* Containers */
+.wp_themeSkin table {
+ background: #cee1ef;
+}
+
+.wp_themeSkin iframe {
+ background: #fff;
+}
+
+/* Layout */
+.wp_themeSkin .mceStatusbar {
+ color:#000;
+ background-color: #eaf3fa;
+}
+
+/* Button */
+.wp_themeSkin .mceButton {
+ background-color: #e9e8e8;
+ border-color: #abc0fb;
+}
+
+.wp_themeSkin a.mceButtonEnabled:hover,
+.wp_themeSkin a.mceButtonActive,
+.wp_themeSkin a.mceButtonSelected {
+ background-color: #d6d8da;
+ border-color: #7789ba !important;
+}
+
+.wp_themeSkin .mceButtonDisabled {
+ border-color: #bdd !important;
+}
+
+/* ListBox */
+.wp_themeSkin .mceListBox .mceText,
+.wp_themeSkin .mceListBox .mceOpen {
+ border-color: #abc0fb;
+ background-color: #e9e8e8;
+}
+
+.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
+.wp_themeSkin .mceListBoxHover .mceOpen,
+.wp_themeSkin .mceListBoxSelected .mceOpen,
+.wp_themeSkin .mceListBoxSelected .mceText {
+ border-color: #7789ba !important;
+ background-color: #d6d8da;
+}
+
+.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
+.wp_themeSkin .mceListBoxHover .mceText {
+ border-color: #7789ba !important;
+}
+
+.wp_themeSkin select.mceListBox {
+ border-color: #b3c7e1;
+ background-color: #fff;
+}
+
+/* SplitButton */
+.wp_themeSkin .mceSplitButton a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceOpen {
+ background-color: #e9e8e8;
+ border-color: #abc0fb;
+}
+
+.wp_themeSkin .mceSplitButton a.mceOpen:hover,
+.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
+.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceAction:hover {
+ background-color: #d6d8da;
+ border-color: #7789ba !important;
+}
+
+.wp_themeSkin .mceSplitButtonActive {
+ background-color: #d6d8da;
+}
+
+/* ColorSplitButton */
+.wp_themeSkin div.mceColorSplitMenu table {
+ background-color: #ebeaeb;
+ border-color: #808080;
+}
+
+.wp_themeSkin .mceColorSplitMenu a {
+ border-color: #808080;
+}
+
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
+ border-color: #fff;
+}
+
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
+ border-color: #0A246A;
+ background-color: #B6BDD2;
+}
+
+.wp_themeSkin a.mceMoreColors:hover {
+ border-color: #0A246A;
+}
+
+/* Menu */
+.wp_themeSkin .mceMenu {
+ border-color: #ddd;
+}
+
+.wp_themeSkin .mceMenu table {
+ background-color: #ebeaeb;
+}
+
+.wp_themeSkin .mceMenu .mceText {
+ color: #000;
+}
+
+.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
+.wp_themeSkin .mceMenu .mceMenuItemActive {
+ background-color: #CEE1EF;
+}
+.wp_themeSkin td.mceMenuItemSeparator {
+ background-color: #aaa;
+}
+.wp_themeSkin .mceMenuItemTitle a {
+ background-color: #ccc;
+ border-bottom-color: #aaa;
+}
+.wp_themeSkin .mceMenuItemTitle span.mceText {
+ color: #000;
+}
+.wp_themeSkin .mceMenuItemDisabled .mceText {
+ color: #888;
+}
+
+/* pop-up */
+.clearlooks2 .mceTop .mceLeft, .clearlooks2 .mceTop .mceRight {
+ background-color: #cee1ef;
+ border-color: #c6d9e9;
+}
+
+.clearlooks2 .mceFocus .mceTop .mceLeft, .clearlooks2 .mceFocus .mceTop .mceRight {
+ background-color: #2683ae;
+ border-color: #464646;
+}
+
+#editorcontainer {
+ border-color: #ccc;
+}
+
+#poststuff #titlewrap {
+ border-color: #ccc;
+}
+
+.curtime {
+ color: #666;
+} \ No newline at end of file
diff --git a/wp-admin/css/dashboard.css b/wp-admin/css/dashboard.css
new file mode 100644
index 0000000..003e8e3
--- /dev/null
+++ b/wp-admin/css/dashboard.css
@@ -0,0 +1,283 @@
+/* Right Now */
+
+#rightnow {
+ border-width: 1px;
+ border-style: solid;
+ padding: 2px;
+ margin-top: 10px;
+ margin-right: 7px;
+}
+
+#rightnow .reallynow {
+ padding: 6px;
+ font-size: 15px;
+ line-height: 2;
+ margin: 0;
+}
+
+#rightnow .rbutton {
+ font-weight: normal;
+ padding: 6px;
+ border-bottom: none;
+ -moz-border-radius: 2px;
+ -khtml-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ text-decoration: none;
+}
+
+#rightnow .reallynow span {
+ display: block;
+ text-align: left;
+ float: left;
+ padding: 0 6px;
+}
+
+#rightnow .reallynow a {
+ display: block;
+ text-align: right;
+ float: right;
+ padding: 0 6px;
+ font-size: 14px;
+ margin: 1px 6px 0 0;
+}
+
+#rightnow .youhave {
+ font-size: 14px;
+ padding: 10px;
+}
+
+#rightnow h3, #rightnow p {
+ padding: 0 10px;
+}
+
+#rightnow a {
+ font-weight: bold;
+}
+
+/* Widgets */
+
+div#dashboard-widgets-wrap {
+ margin-top: -20px;
+ margin-right: -13px; /* 20 (div.dashboard-widget margin-right) - 7 (#rightnow margin-right) */
+}
+
+div#dashboard-widgets {
+ width: 100%;
+ padding-right: 7px; /* (#rightnow margin-right) */
+}
+
+div.dashboard-widget-holder {
+ margin-top: 20px;
+ width: 50%;
+ float: left;
+}
+
+div.dashboard-widget-holder.third {
+ width: 33.3%;
+}
+
+div.dashboard-widget-holder.fourth {
+ width: 25%;
+}
+
+div.dashboard-widget-holder.full {
+ width: 100%;
+}
+
+div.dashboard-widget-holder.double div.dashboard-widget {
+ height: 52em;
+ padding-bottom: 28px /* lame */
+}
+
+div.dashboard-widget {
+ position: relative;
+ margin-right: 20px;
+ border-width: 1px;
+ border-style: solid;
+ padding: 2px;
+ height: 27em;
+ overflow: auto;
+ font-size: 11px;
+}
+
+h3.dashboard-widget-title {
+ margin: 0;
+ padding: 0 7px;
+ font-size: 14px;
+ line-height: 2;
+}
+
+h3.dashboard-widget-title span {
+ display: block;
+ text-align: left;
+ float: left;
+}
+
+h3.dashboard-widget-title small {
+ display: block;
+ text-align: right;
+ float: right;
+ font-size: 75%;
+ line-height: 2.67; /* math: it works, bitches */
+}
+
+h3.dashboard-widget-title img.rss-icon {
+ vertical-align: middle;
+ margin: .5em 0;
+}
+
+div.dashboard-widget-notice {
+ padding: 0 14px;
+ font-size: 1.2em;
+ line-height: 2;
+}
+
+div.dashboard-widget-error {
+ padding: 0 20px;
+ font-size: 1.2em;
+ line-height: 2;
+}
+
+div.dashboard-widget-content {
+ padding: 10px 15px;
+}
+
+div.dashboard-widget-submit {
+ border-top: 1px solid #ccc;
+ padding: 1em 0 0 0;
+ margin: 10px 0 0 0;
+}
+div.dashboard-widget-submit input {
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ padding: 4px 6px;
+ border: none;
+ font-size: 13px;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ cursor: pointer;
+ text-decoration: none;
+}
+
+div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl {
+ margin: 0;
+ text-indent: 0;
+ padding-left: 15px;
+}
+div.dashboard-widget-content li {
+ margin: .5em 0 1em;
+}
+
+div.dashboard-widget-content blockquote {
+ margin: -1em 0;
+}
+
+div#dashboard_recent_comments p {
+ font-size: 14px;
+}
+
+div.dashboard-widget-content p.comment-meta {
+ font-size: 11px !important;
+}
+
+#dashboard_secondary div.dashboard-widget {
+ height: auto;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul {
+ list-style: none;
+ padding: 0;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul li {
+ display: block;
+ width: 19.95%;
+ padding-bottom: 10px;
+ margin: 0;
+ float: left;
+ font-size: 95%;
+}
+
+#dashboard_secondary div.dashboard-widget-content {
+ margin: 10px 5px;
+ padding: 0;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul li .post {
+ display:block;
+ font-family:Georgia,"Times New Roman",Times,serif;
+ font-size:18px;
+ line-height: 1.2em;
+ height:90px;
+ overflow:hidden;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul li a {
+ display: block;
+ height:100%;
+ overflow:hidden;
+ margin: 5px 10px;
+ text-decoration: none;
+ padding: .5em;
+ border-right: 1px solid #dadada;
+ border-bottom: 1px solid #dadada;
+}
+
+#dashboard_secondary div.dashboard-widget-content ul li a cite {
+ display: block;
+ font-family: "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+}
+
+#dashboard-widgets .widget_rss ul {
+ list-style: none;
+ padding: 0;
+}
+
+#dashboard-widgets .widget_rss ul li {
+ clear: both;
+}
+
+#dashboard-widgets .widget_rss ul li span.rss-date {
+ float: left;
+ margin: 0;
+}
+
+#dashboard-widgets .widget_rss ul li a {
+ float: left;
+ margin: 0 .5em .2em 0;
+ font-weight: bold;
+}
+
+#dashboard-widgets .widget_rss ul li div {
+ clear: both;
+ line-height: 1.5em;
+}
+
+#dashboard_primary a.rsswidget, #dashboard_plugins h5 {
+ font-size: 14px;
+}
+
+#dashboard_primary span.rss-date {
+ font-size: 14px;
+}
+
+#dashboard_plugins h4 {
+ font-size: 1em;
+ margin: 0 0 .1em;
+}
+
+#dashboard_plugins h5 {
+ margin: 0;
+ display: inline;
+ line-height: 1.4em;
+}
+
+#dashboard_plugins p {
+ margin: 0 0 1em;
+ line-height: 1.5em;
+}
+
+.widget-loading {
+}
diff --git a/wp-admin/css/global.css b/wp-admin/css/global.css
new file mode 100644
index 0000000..5bd9e2f
--- /dev/null
+++ b/wp-admin/css/global.css
@@ -0,0 +1,126 @@
+/* styles for use by people extending the WordPress interface */
+
+
+body {
+ margin: 0;
+ padding: 0;
+}
+
+body, td {
+ font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+}
+
+form, label input { margin: 0; padding: 0; }
+
+img { border: 0; }
+
+label { cursor: pointer; }
+
+li, dd { margin-bottom: 6px; }
+
+p, li, dl, dd, dt { line-height: 140%; }
+
+textarea, input, select {
+ font: 13px Verdana, Arial, Helvetica, sans-serif;
+ margin: 1px;
+ padding: 3px;
+}
+
+.alignleft { float: left; }
+
+.alignright { float: right; }
+
+
+.clear { clear: both; height: 2px; }
+
+.hidden { display: none; }
+
+.subsubsub {
+ list-style: none;
+ margin: 15px 0 10px 0;
+ padding: 0;
+ white-space: nowrap;
+ font-size: 12px;
+}
+
+.subsubsub a { line-height: 200%; padding: 3px; text-decoration: none; }
+
+.subsubsub a.current { font-weight: bold; background: none; border: none;}
+
+.subsubsub li { display: inline; margin: 0; padding: 0; }
+
+.widefat {
+ border-width: 1px;
+ border-style: solid;
+ border-collapse: collapse;
+ width: 100%;
+ clear: both;
+}
+
+.widefat a {
+ text-decoration: none;
+}
+
+.widefat td, .widefat th {
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ border-bottom-color: #ccc;
+ font-size: 12px;
+ padding: 10px 10px 20px;
+ vertical-align: text-top;
+}
+
+.widefat th {
+ padding-bottom: 8px;
+ padding-top: 10px;
+ text-align: left;
+}
+
+.widefat .check-column {
+ text-align: center;
+ vertical-align: text-top;
+ width: 3%;
+}
+
+.wrap, .updated, .error {
+ margin: 0;
+ margin-left: 15px;
+ margin-right: 15px;
+ padding: 0;
+ max-width: 980px;
+}
+
+.updated, .error {
+ border-width: 1px;
+ border-style: solid;
+ padding: 0 15px;
+ max-width: 950px;
+ margin-bottom: 1em;
+}
+
+.wrap .updated, .wrap .error {
+ margin: auto 0 0;
+}
+
+.updated a, .error a {
+ text-decoration: underline;
+}
+
+.updated a {
+ text-decoration: none;
+ padding-bottom: 2px;
+}
+
+.wrap h2 {
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ clear: both;
+ font: 24px Georgia, "Times New Roman", Times, serif;
+ margin: 5px 0 0 -4px;
+ padding: 0;
+ padding-bottom: 7px;
+}
+
+#timestampdiv {
+ display: none;
+} \ No newline at end of file
diff --git a/wp-admin/css/ie.css b/wp-admin/css/ie.css
new file mode 100644
index 0000000..dd7deaa
--- /dev/null
+++ b/wp-admin/css/ie.css
@@ -0,0 +1,58 @@
+/* Fixes for IE bugs */
+
+#poststuff .postbox h3 {
+ padding-left: 23px;
+}
+
+#submenu li a.current {
+ background:none;
+ border:none;
+}
+
+* html body.minwidth {
+ _width: expression(document.documentElement.clientWidth < 810 ? "808px" : "99.9%");
+}
+
+* html #wpbody {
+ _width: expression(document.documentElement.clientWidth > 982 ? "980px" : "99.9%");
+}
+
+* html #poststuff .postarea, * html #poststuff #titlediv {
+ width: 95%;
+ margin-left: 3%;
+}
+
+.submitbox {
+ margin-top: 10px;
+}
+
+* html div.widget-liquid-left-holder, * html div.widget-liquid-right {
+ display: block;
+ position: relative;
+}
+
+#wpwrap, #wpcontent, #post, #wrap, #postdivrich, #postdiv, #poststuff, #titlediv, #post-body, #editorcontainer, .tablenav, .widget-control-list {
+ display: block;
+ zoom: 100%;
+}
+
+* html #editorcontainer {
+ padding: 0;
+}
+
+* html #editorcontainer #content {
+ position: relative;
+ overflow: auto;
+ padding: 6px;
+ margin: auto;
+ width: 98%;
+}
+
+form#template div {
+ width: 100%;
+}
+
+#ed_toolbar input {
+ overflow: visible;
+ padding: 1px 5px;
+}
diff --git a/wp-admin/css/login.css b/wp-admin/css/login.css
new file mode 100644
index 0000000..92f10bc
--- /dev/null
+++ b/wp-admin/css/login.css
@@ -0,0 +1,74 @@
+* { margin: 0; padding: 0; }
+
+body {
+ border-top-width: 30px;
+ border-top-style: solid;
+ font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+}
+
+form {
+ margin-left: 8px;
+ padding: 16px 16px 40px 16px;
+ font-weight: bold;
+ -moz-border-radius: 5px;
+ -khtml-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+
+form .forgetmenot { font-weight: normal; float: left; margin-bottom: 0;}
+
+#login form .submit input {
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ padding: 3px 5px;
+ border: none;
+ font-size: 13px;
+ border-width: 1px;
+ border-style: solid;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ cursor: default;
+ text-decoration: none;
+ margin-top: -6px;
+}
+
+form .submit { float: right; }
+
+form p { margin-bottom: 24px; }
+
+h1 a {
+ background: url(../images/logo-login.gif) no-repeat;
+ width: 292px;
+ height: 66px;
+ text-indent: -9999px;
+ overflow: hidden;
+ padding-bottom: 15px;
+ display: block;
+}
+
+#backtoblog a {
+ position: absolute;
+ top: 7px;
+ left: 15px;
+ text-decoration: none;
+}
+
+#login { width: 292px; margin: 7em auto; }
+
+#login_error, .message {
+ margin: 0 0 16px 8px;
+ border-width: 1px;
+ border-style: solid;
+ padding: 12px;
+}
+
+#nav { margin: 0 0 0 8px; padding: 16px; }
+
+#user_pass, #user_login, #user_email {
+ font-size: 20px;
+ width: 97%;
+ padding: 3px;
+ margin-right: 6px;
+} \ No newline at end of file
diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css
new file mode 100644
index 0000000..a5b354e
--- /dev/null
+++ b/wp-admin/css/media.css
@@ -0,0 +1,238 @@
+div#media-upload-header {
+ margin: 0;
+ padding: 0 5px;
+ font-weight: bold;
+ position: relative;
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ height: 2.5em;
+}
+
+ul#sidemenu {
+ font-weight: normal;
+ margin: 0 5px;
+ position: absolute;
+ left: 0px;
+ bottom: -1px;
+}
+
+div#media-upload-error {
+ margin: 1em;
+ font-weight: bold;
+}
+
+form {
+ margin: 1em;
+}
+
+#search-filter {
+ text-align: right;
+}
+
+.media-upload-form label, .media-upload-form legend {
+ display:block;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ margin: 0 0 0.5em 0;
+}
+
+th { position: relative; }
+
+.media-upload-form label.form-help, td.help {
+ font-style: italic;
+ font-weight: normal;
+}
+
+.media-upload-form p.help {
+ margin: 0;
+ padding: 0;
+}
+
+.media-upload-form fieldset {
+ width: 100%;
+ border: none;
+ text-align: justify;
+ margin: 0 0 1em 0;
+ padding: 0;
+}
+
+/* specific to the image upload form */
+.align .field label {
+ display: inline;
+ padding: 0 0 0 28px;
+ margin: 0 1em 0 0;
+}
+.image-align-none-label {
+ background: url(../images/align-none.png) no-repeat center left;
+}
+
+.image-align-left-label {
+ background: url(../images/align-left.png) no-repeat center left;
+}
+
+.image-align-center-label {
+ background: url(../images/align-center.png) no-repeat center left;
+}
+
+.image-align-right-label {
+ background: url(../images/align-right.png) no-repeat center left;
+}
+
+#flash-upload-ui, .insert-gallery {
+ display: none;
+}
+
+tr.image-size label {
+ display: inline;
+ margin: 0 1em 0 0;
+}
+.pinkynail {
+ max-width: 40px;
+ max-height: 40px;
+}
+
+.filename {
+ display: none;
+}
+button.dismiss {
+ position: absolute;
+ top: 5px;
+ right: 5px;
+ z-index: 4;
+}
+.file-error {
+ margin: 0 0 5px 50px;
+ font-weight: bold;
+}
+
+.progress {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 623px;
+ height: 36px;
+}
+.bar {
+ width: 0px;
+ height: 100%;
+ border-right-width: 3px;
+ border-right-style: solid;
+}
+.media-item .thumbnail {
+ max-width: 128px;
+ max-height: 128px;
+}
+.media-item .pinkynail {
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ height: 32px;
+ max-width: 40px;
+}
+
+tbody.media-item-info tr {
+ background-color: transparent;
+}
+tbody.media-item-info th, tbody.media-item-info td {
+ border: none;
+ margin: 0;
+}
+
+.form-table tbody.media-item-info {
+ border: 8px solid #fff;
+}
+
+.describe.startopen, .describe.startclosed {
+ display: none;
+}
+abbr.required {
+ text-decoration: none;
+ border: none;
+}
+.describe label {
+ display: inline;
+}
+.describe td {
+ vertical-align: middle;
+}
+.describe td.A1 {
+ width: 132px;
+}
+.describe input[type="text"], .describe textarea {
+ width: 460px;
+}
+.describe-toggle-on, .describe-toggle-off {
+ display: block;
+ line-height: 36px;
+ z-index: 2;
+ position: absolute;
+ top: 0px;
+ right: 20px;
+}
+.describe-toggle-off {
+ display: none;
+}
+.clickmask {
+ background: transparent;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ cursor: pointer;
+ border: none;
+ z-index: 3;
+ height: 36px;
+}
+
+.hidden {
+ height: 0px;
+ width: 0px;
+ overflow: hidden;
+ border: none;
+}
+
+/* Specific to Uploader */
+
+#media-upload .media-upload-form p {
+ margin: 0 1em 1em 0;
+}
+#media-upload p.help {
+ font-style: italic;
+ font-weight: normal;
+}
+#media-upload tr.image-size td.field {
+ text-align: center;
+}
+#media-upload #media-items {
+ border-width: 1px;
+ border-style: solid;
+ border-bottom: none;
+ width: 623px;
+}
+
+#media-upload .media-item {
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ width: 623px;
+ position: relative;
+ min-height: 36px;
+}
+#media-upload .filename {
+ display: block;
+ line-height: 36px;
+ margin-left: 50px;
+ z-index: 2;
+}
+#media-upload .describe {
+ border-top-width: 1px;
+ border-top-style: solid;
+ padding: 5px;
+ width: 100%;
+ clear: both;
+}
+#media-upload .describe th.label {
+ padding-top: .5em;
+ text-align: left;
+}
+#media-upload tr.align td.field {
+ text-align: center;
+} \ No newline at end of file
diff --git a/wp-admin/css/theme-editor.css b/wp-admin/css/theme-editor.css
new file mode 100644
index 0000000..eaaa946
--- /dev/null
+++ b/wp-admin/css/theme-editor.css
@@ -0,0 +1,44 @@
+#template textarea {
+ font-family: 'Courier New', Courier, monospace;
+ font-size: 12px;
+ width: 97%;
+}
+
+#template p {
+ width: 97%;
+}
+
+#templateside {
+ float: right;
+ width: 190px;
+ margin-top:-3.4em;
+}
+
+#templateside h3, #postcustomstuff p.submit {
+ margin: 0;
+}
+
+#templateside ol, #templateside ul {
+ list-style: none;
+ margin: .5em;
+ padding: 0;
+}
+
+#templateside ol li, #templateside ul li {
+ margin: 1px 0px;
+}
+
+#themeselector {
+ padding-right: 5px;
+ float: right;
+ position: relative;
+ bottom: 25px;
+}
+
+.nonessential {
+ font-size: small;
+}
+
+.highlight {
+ padding: 1px;
+} \ No newline at end of file
diff --git a/wp-admin/css/upload-rtl.css b/wp-admin/css/upload-rtl.css
deleted file mode 100644
index dc13a4b..0000000
--- a/wp-admin/css/upload-rtl.css
+++ /dev/null
@@ -1,12 +0,0 @@
-html {
- direction: ltr;
- }
-#uploadoptions, table {
- direction: rtl;
- }
-td {
- padding: 1px 6px 0;
- }
-.submit {
- text-align: left;
- } \ No newline at end of file
diff --git a/wp-admin/css/upload.css b/wp-admin/css/upload.css
deleted file mode 100644
index 009986c..0000000
--- a/wp-admin/css/upload.css
+++ /dev/null
@@ -1,204 +0,0 @@
-body { background: #f9fcfe; }
-
-.upload-file-data { display: none; }
-
-#upload-menu {
- border-top: 2em solid #247fab;
- margin: 0;
- padding: 0;
- height: 0;
- list-style: none;
- width: 100%;
-}
-
-body > #upload-menu { border-bottom: 7px solid #fff; }
-
-#upload-menu li {
- margin: 0;
- position: relative;
- top: -2em;
- padding-bottom: 5px;
- border: none;
- border-top: 3px solid #247fab;
-}
-
-#upload-menu li a.upload-tab-link {
- margin-left: 0.75em;
- padding: 5px 5px 0;
- display: block;
- float: left;
- height: 100%;
- text-decoration: none;
- border-bottom: none;
- color: #fff;
-}
-
-#upload-menu li.current {
- border-right: 2px solid #448abd;
- color: #000;
-}
-
-#upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
- background: #f9fcfe;
- color: #000;
-}
-
-#upload-menu li #current-tab-nav {
- background: #f9fcfe;
- float: left;
- padding: 5px 5px 0 0;
- margin-left: -5px;
-}
-
-#upload-menu li span .page-numbers {
- padding: 0;
- border: none;
-}
-
-#upload-menu li span a.page-numbers { color: #00019b; }
-#upload-menu li span a.page-numbers:hover { text-decoration: underline; }
-
-#upload-content {
- position: relative;
- clear: both;
- margin: 0;
- padding: 0;
- border: none;
- width: 100%;
- height: 100%;
- background: none;
-}
-
-#upload-file {
- margin: 0 auto;
- top: 0;
- left: 0;
- width: 95%;
- height: 100%;
- background: #f9fcfe;
-}
-
-#upload-file th {
- width: 8em;
-}
-
-form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; }
-
-form#upload-file .submit input { width: auto; }
-
-#upload-file-view { padding: 0 0 0 75px; }
-
-#file-title {
- margin: 0 0 .2em 75px;
- padding: 0;
- display: block;
- font-family: Georgia, "Times New Roman", Times, serif;
- font-size: 16px;
-}
-
-h2 {
- margin: 0 .2em 0 0;
- padding: 0;
- display: inline;
- border: none;
- color: #000;
- font-size: 1.4em;
- line-height: 1.4em;
-}
-
-.wrap h2 {
- margin: .4em 0 .5em;
- display: block;
- border-bottom: .5em solid #e5f3ff;
- color: #333;
- font: normal 32px/5px serif;
- clear: both;
-}
-
-* html .wrap h2 {
- margin-top: 1em;
-}
-
-.back {
- display: block;
- position: absolute;
- left: 14px;
- top: 10px;
-}
-
-#upload-files {
- list-style-type: none;
- margin: 0;
- padding: 15px 0 0;
-}
-
-#upload-files li { margin: 0 0 15px 15px; }
-
-#upload-files a, #upload-file-view a, a.file-link {
- border: none;
- text-decoration: none;
-}
-
-#upload-file-view a img { padding-bottom: .2em; border-bottom: 1px solid #6699CC; }
-
-#upload-files a.file-link {
- display: block;
- width: 130px;
- height: 128px;
- background-color: rgb(209, 226, 239);
- text-align: center;
- overflow: hidden;
-}
-
-#upload-files a.text {
- padding-top: 40px;
- height: 88px;
- font-size: 16px;
-}
-
-#upload-files a.file-link.image {
- font-size: 2px;
- letter-spacing: 0;
-}
-
-#upload-files a.file-link img { vertical-align: middle; }
-
-#the-attachment-links textarea {
- font-size: 10px;
- overflow: hidden;
-}
-
-form table { float: none; padding: 0 15px; }
-
-table {
- float: left;
- margin: 0;
- padding: 0;
-}
-
-th { text-align: right; vertical-align: text-top; }
-
-tr, td, th {
- margin-top: 0;
- padding-top: 0;
-}
-
-#uploadoptions th {
- width: 80px;
-}
-
-#uploadoptions p {
- margin: 0;
- padding: 0;
-}
-
-#uploadoptions td {
- padding-left: 1em;
- line-height: 140%;
-}
-
-#uploadoptions table {
- width: 300px;
-}
-
-input.readonly { background-color: #ddd; }
diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php
new file mode 100644
index 0000000..8eb9066
--- /dev/null
+++ b/wp-admin/edit-attachment-rows.php
@@ -0,0 +1,138 @@
+<?php if ( ! defined('ABSPATH') ) die(); ?>
+<table class="widefat">
+ <thead>
+ <tr>
+
+<?php $posts_columns = wp_manage_media_columns(); ?>
+<?php foreach($posts_columns as $column_display_name) { ?>
+ <th scope="col"><?php echo $column_display_name; ?></th>
+<?php } ?>
+
+ </tr>
+ </thead>
+ <tbody id="the-list" class="list:post">
+<?php
+$i_post = 0;
+if ( have_posts() ) {
+$bgcolor = '';
+add_filter('the_title','wp_specialchars');
+while (have_posts()) : the_post(); $i_post++;
+if ( 16 == $i_post )
+ echo "\t</tbody>\n\t<tbody id='the-extra-list' class='list:post' style='display: none'>\n"; // Hack!
+$class = ( $i_post > 15 || 'alternate' == $class) ? '' : 'alternate';
+global $current_user;
+$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
+?>
+ <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
+
+<?php
+
+foreach($posts_columns as $column_name=>$column_display_name) {
+
+ switch($column_name) {
+
+ case 'cb':
+ ?>
+ <th scope="row" style="text-align: center"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
+ <?php
+ break;
+
+ case 'icon':
+ ?>
+ <td class="media-icon"><?php echo wp_get_attachment_link($post->ID, array(60, 40), false, true); ?></td>
+ <?php
+ // TODO
+ break;
+
+ case 'media':
+ ?>
+ <td><strong><a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>"><?php the_title(); ?></a></strong><br />
+ <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
+ <?php do_action('manage_media_media_column', $post->ID); ?>
+ </td>
+ <?php
+ break;
+
+ case 'desc':
+ ?>
+ <td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
+ <?php
+ break;
+
+ case 'date':
+ if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
+ $t_time = $h_time = __('Unpublished');
+ } else {
+ $t_time = get_the_time(__('Y/m/d g:i:s A'));
+ $m_time = $post->post_date;
+ $time = get_post_time( 'G', true );
+ if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
+ if ( $t_diff < 0 )
+ $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
+ else
+ $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
+ } else {
+ $h_time = mysql2date(__('Y/m/d'), $m_time);
+ }
+ }
+ ?>
+ <td><?php echo $h_time ?></td>
+ <?php
+ break;
+
+ case 'parent':
+ if ( $post_parent = get_post($post->post_parent) ) {
+ $title = get_the_title($post->post_parent);
+ if ( empty($title) )
+ $title = __('(no title)');
+ } else {
+ $title = '';
+ }
+ ?>
+ <td><strong><a href="post.php?action=edit&amp;post=<?php echo $post->post_parent; ?>"><?php echo $title ?></a></strong></td>
+ <?php
+ break;
+
+ case 'comments':
+ ?>
+ <td style="text-align: center">
+ <?php
+ $left = get_pending_comments_num( $post->ID );
+ $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
+ if ( $left )
+ echo '<strong>';
+ comments_number("<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
+ if ( $left )
+ echo '</strong>';
+ ?>
+ </td>
+ <?php
+ break;
+
+ case 'location':
+ ?>
+ <td><a href="<?php the_permalink(); ?>"><?php _e('Permalink'); ?></a></td>
+ <?php
+ break;
+
+ default:
+ ?>
+ <td><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
+ <?php
+ break;
+ }
+}
+?>
+ </tr>
+<?php
+endwhile;
+} else {
+?>
+ <tr style='background-color: <?php echo $bgcolor; ?>'>
+ <td colspan="8"><?php _e('No posts found.') ?></td>
+ </tr>
+<?php
+} // end if ( have_posts() )
+?>
+ </tbody>
+</table>
diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php
new file mode 100644
index 0000000..c3a6665
--- /dev/null
+++ b/wp-admin/edit-tag-form.php
@@ -0,0 +1,41 @@
+<?php
+if ( ! empty($tag_ID) ) {
+ $heading = __('Edit Tag');
+ $submit_text = __('Edit Tag');
+ $form = '<form name="edittag" id="edittag" method="post" action="edit-tags.php">';
+ $action = 'editedtag';
+ $nonce_action = 'update-tag_' . $tag_ID;
+ do_action('edit_tag_form_pre', $tag);
+} else {
+ $heading = __('Add Tag');
+ $submit_text = __('Add Tag');
+ $form = '<form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list:">';
+ $action = 'addtag';
+ $nonce_action = 'add-tag';
+ do_action('add_tag_form_pre', $tag);
+}
+?>
+
+<div class="wrap">
+<h2><?php echo $heading ?></h2>
+<div id="ajax-response"></div>
+<?php echo $form ?>
+<input type="hidden" name="action" value="<?php echo $action ?>" />
+<input type="hidden" name="tag_ID" value="<?php echo $tag->term_id ?>" />
+<?php wp_nonce_field($nonce_action); ?>
+ <table class="form-table">
+ <tr class="form-field form-required">
+ <th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
+ <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" />
+ <p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
+ </tr>
+ <tr class="form-field">
+ <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
+ <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($tag->slug); ?>" size="40" />
+ <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
+ </tr>
+ </table>
+<p class="submit"><input type="submit" class="button" name="submit" value="<?php echo $submit_text ?>" /></p>
+<?php do_action('edit_tag_form', $tag); ?>
+</form>
+</div>
diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php
new file mode 100644
index 0000000..fe6b89f
--- /dev/null
+++ b/wp-admin/edit-tags.php
@@ -0,0 +1,202 @@
+<?php
+require_once('admin.php');
+
+$title = __('Tags');
+$parent_file = 'edit.php';
+
+wp_reset_vars(array('action', 'tag'));
+
+if ( isset($_GET['deleteit']) && isset($_GET['delete_tags']) )
+ $action = 'bulk-delete';
+
+switch($action) {
+
+case 'addtag':
+
+ check_admin_referer('add-tag');
+
+ if ( !current_user_can('manage_categories') )
+ wp_die(__('Cheatin&#8217; uh?'));
+
+ $ret = wp_insert_term($_POST['name'], 'post_tag', $_POST);
+ if ( $ret && !is_wp_error( $ret ) ) {
+ wp_redirect('edit-tags.php?message=1#addtag');
+ } else {
+ wp_redirect('edit-tags.php?message=4#addtag');
+ }
+ exit;
+break;
+
+case 'delete':
+ $tag_ID = (int) $_GET['tag_ID'];
+ check_admin_referer('delete-tag_' . $tag_ID);
+
+ if ( !current_user_can('manage_categories') )
+ wp_die(__('Cheatin&#8217; uh?'));
+
+ wp_delete_term( $tag_ID, 'post_tag');
+
+ wp_redirect('edit-tags.php?message=2');
+ exit;
+
+break;
+
+case 'bulk-delete':
+ check_admin_referer('bulk-tags');
+
+ if ( !current_user_can('manage_categories') )
+ wp_die(__('Cheatin&#8217; uh?'));
+
+ $tags = $_GET['delete_tags'];
+ foreach( (array) $tags as $tag_ID ) {
+ wp_delete_term( $tag_ID, 'post_tag');
+ }
+
+ wp_redirect('edit-tags.php?message=6');
+ exit;
+
+break;
+
+case 'edit':
+
+ require_once ('admin-header.php');
+ $tag_ID = (int) $_GET['tag_ID'];
+
+ $tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
+ include('edit-tag-form.php');
+
+break;
+
+case 'editedtag':
+ $tag_ID = (int) $_POST['tag_ID'];
+ check_admin_referer('update-tag_' . $tag_ID);
+
+ if ( !current_user_can('manage_categories') )
+ wp_die(__('Cheatin&#8217; uh?'));
+
+ $ret = wp_update_term($tag_ID, 'post_tag', $_POST);
+ if( $ret && !is_wp_error( $ret ) ) {
+ wp_redirect('edit-tags.php?message=3');
+ } else {
+ wp_redirect('edit-tags.php?message=5');
+ }
+ exit;
+break;
+
+default:
+
+if ( !empty($_GET['_wp_http_referer']) ) {
+ wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+ exit;
+}
+
+wp_enqueue_script( 'admin-tags' );
+wp_enqueue_script('admin-forms');
+
+require_once ('admin-header.php');
+
+$messages[1] = __('Tag added.');
+$messages[2] = __('Tag deleted.');
+$messages[3] = __('Tag updated.');
+$messages[4] = __('Tag not added.');
+$messages[5] = __('Tag not updated.');
+$messages[6] = __('Tags deleted.');
+?>
+
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
+endif; ?>
+
+<div class="wrap">
+
+<form id="posts-filter" action="" method="get">
+<?php if ( current_user_can('manage_categories') ) : ?>
+ <h2><?php printf(__('Manage Tags (<a href="%s">add new</a>)'), '#addtag') ?> </h2>
+<?php else : ?>
+ <h2><?php _e('Manage Tags') ?> </h2>
+<?php endif; ?>
+
+<p id="post-search">
+ <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
+ <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
+</p>
+
+<br style="clear:both;" />
+
+<div class="tablenav">
+
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+ $pagenum = 1;
+if( !$tagsperpage || $tagsperpage < 0 )
+ $tagsperpage = 20;
+
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
+ 'format' => '',
+ 'total' => ceil(wp_count_terms('post_tag') / $tagsperpage),
+ 'current' => $pagenum
+));
+
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
+<div style="float: left">
+<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+<?php wp_nonce_field('bulk-tags'); ?>
+</div>
+
+<br style="clear:both;" />
+</div>
+
+<br style="clear:both;" />
+
+<table class="widefat">
+ <thead>
+ <tr>
+ <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col"><?php _e('Name') ?></th>
+ <th scope="col" style="width: 90px"><?php _e('Posts') ?></th>
+ </tr>
+ </thead>
+ <tbody id="the-list" class="list:tag">
+<?php
+
+$searchterms = trim( $_GET['s'] );
+
+$count = tag_rows( $pagenum, $tagsperpage, $searchterms );
+?>
+ </tbody>
+</table>
+</form>
+
+<br style="clear:both;" />
+
+<div class="tablenav">
+
+<?php
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+<br style="clear:both;" />
+</div>
+
+</div>
+
+<?php if ( current_user_can('manage_categories') ) : ?>
+
+<br />
+<?php include('edit-tag-form.php'); ?>
+
+<?php endif; ?>
+
+<?php
+break;
+}
+
+include('admin-footer.php');
+
+?>
diff --git a/wp-admin/images/align-center.png b/wp-admin/images/align-center.png
new file mode 100644
index 0000000..a412226
--- /dev/null
+++ b/wp-admin/images/align-center.png
Binary files differ
diff --git a/wp-admin/images/align-left.png b/wp-admin/images/align-left.png
new file mode 100644
index 0000000..2e433fc
--- /dev/null
+++ b/wp-admin/images/align-left.png
Binary files differ
diff --git a/wp-admin/images/align-none.png b/wp-admin/images/align-none.png
new file mode 100644
index 0000000..5fb9af2
--- /dev/null
+++ b/wp-admin/images/align-none.png
Binary files differ
diff --git a/wp-admin/images/align-right.png b/wp-admin/images/align-right.png
new file mode 100644
index 0000000..9b92578
--- /dev/null
+++ b/wp-admin/images/align-right.png
Binary files differ
diff --git a/wp-admin/images/box-bg-left.gif b/wp-admin/images/box-bg-left.gif
deleted file mode 100644
index c3c7e35..0000000
--- a/wp-admin/images/box-bg-left.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-bg-right.gif b/wp-admin/images/box-bg-right.gif
deleted file mode 100644
index 12a0d1a..0000000
--- a/wp-admin/images/box-bg-right.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-bg.gif b/wp-admin/images/box-bg.gif
deleted file mode 100644
index 2eb7f58..0000000
--- a/wp-admin/images/box-bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-butt-left.gif b/wp-admin/images/box-butt-left.gif
deleted file mode 100644
index 590c2ef..0000000
--- a/wp-admin/images/box-butt-left.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-butt-right.gif b/wp-admin/images/box-butt-right.gif
deleted file mode 100644
index 487ebb3..0000000
--- a/wp-admin/images/box-butt-right.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-butt.gif b/wp-admin/images/box-butt.gif
deleted file mode 100644
index 514a165..0000000
--- a/wp-admin/images/box-butt.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-head-left.gif b/wp-admin/images/box-head-left.gif
deleted file mode 100644
index b03e075..0000000
--- a/wp-admin/images/box-head-left.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-head-right.gif b/wp-admin/images/box-head-right.gif
deleted file mode 100644
index 897b03a..0000000
--- a/wp-admin/images/box-head-right.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/box-head.gif b/wp-admin/images/box-head.gif
deleted file mode 100644
index 5c09a9a..0000000
--- a/wp-admin/images/box-head.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/bubble_bg.gif b/wp-admin/images/bubble_bg.gif
new file mode 100644
index 0000000..c6f395a
--- /dev/null
+++ b/wp-admin/images/bubble_bg.gif
Binary files differ
diff --git a/wp-admin/images/comment-grey-bubble.png b/wp-admin/images/comment-grey-bubble.png
new file mode 100644
index 0000000..6f1e765
--- /dev/null
+++ b/wp-admin/images/comment-grey-bubble.png
Binary files differ
diff --git a/wp-admin/images/comment-pill.gif b/wp-admin/images/comment-pill.gif
new file mode 100644
index 0000000..2fabf99
--- /dev/null
+++ b/wp-admin/images/comment-pill.gif
Binary files differ
diff --git a/wp-admin/images/comment-stalk-classic.gif b/wp-admin/images/comment-stalk-classic.gif
new file mode 100644
index 0000000..3cf83a5
--- /dev/null
+++ b/wp-admin/images/comment-stalk-classic.gif
Binary files differ
diff --git a/wp-admin/images/comment-stalk-fresh.gif b/wp-admin/images/comment-stalk-fresh.gif
new file mode 100644
index 0000000..9048949
--- /dev/null
+++ b/wp-admin/images/comment-stalk-fresh.gif
Binary files differ
diff --git a/wp-admin/images/date-button.gif b/wp-admin/images/date-button.gif
new file mode 100644
index 0000000..7ee32cb
--- /dev/null
+++ b/wp-admin/images/date-button.gif
Binary files differ
diff --git a/wp-admin/images/heading-bg.gif b/wp-admin/images/heading-bg.gif
deleted file mode 100644
index bea18ca..0000000
--- a/wp-admin/images/heading-bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/login-bkg-bottom.gif b/wp-admin/images/login-bkg-bottom.gif
deleted file mode 100644
index a78656e..0000000
--- a/wp-admin/images/login-bkg-bottom.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/login-bkg-tile.gif b/wp-admin/images/login-bkg-tile.gif
deleted file mode 100644
index 1015a9e..0000000
--- a/wp-admin/images/login-bkg-tile.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/logo-login.gif b/wp-admin/images/logo-login.gif
new file mode 100644
index 0000000..276faf1
--- /dev/null
+++ b/wp-admin/images/logo-login.gif
Binary files differ
diff --git a/wp-admin/images/media-button-gallery.gif b/wp-admin/images/media-button-gallery.gif
new file mode 100644
index 0000000..1191778
--- /dev/null
+++ b/wp-admin/images/media-button-gallery.gif
Binary files differ
diff --git a/wp-admin/images/media-button-image.gif b/wp-admin/images/media-button-image.gif
new file mode 100644
index 0000000..11278c8
--- /dev/null
+++ b/wp-admin/images/media-button-image.gif
Binary files differ
diff --git a/wp-admin/images/media-button-music.gif b/wp-admin/images/media-button-music.gif
new file mode 100644
index 0000000..f85cd43
--- /dev/null
+++ b/wp-admin/images/media-button-music.gif
Binary files differ
diff --git a/wp-admin/images/media-button-other.gif b/wp-admin/images/media-button-other.gif
new file mode 100644
index 0000000..f3f2f8a
--- /dev/null
+++ b/wp-admin/images/media-button-other.gif
Binary files differ
diff --git a/wp-admin/images/media-button-video.gif b/wp-admin/images/media-button-video.gif
new file mode 100644
index 0000000..ceb2734
--- /dev/null
+++ b/wp-admin/images/media-button-video.gif
Binary files differ
diff --git a/wp-admin/images/media-buttons.gif b/wp-admin/images/media-buttons.gif
new file mode 100644
index 0000000..2266040
--- /dev/null
+++ b/wp-admin/images/media-buttons.gif
Binary files differ
diff --git a/wp-admin/images/notice.gif b/wp-admin/images/notice.gif
deleted file mode 100644
index ba6eab0..0000000
--- a/wp-admin/images/notice.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/tail.gif b/wp-admin/images/tail.gif
new file mode 100644
index 0000000..3f8e7d5
--- /dev/null
+++ b/wp-admin/images/tail.gif
Binary files differ
diff --git a/wp-admin/images/toggle-arrow.gif b/wp-admin/images/toggle-arrow.gif
new file mode 100644
index 0000000..86cb448
--- /dev/null
+++ b/wp-admin/images/toggle-arrow.gif
Binary files differ
diff --git a/wp-admin/images/toggle.gif b/wp-admin/images/toggle.gif
deleted file mode 100644
index 72e8b44..0000000
--- a/wp-admin/images/toggle.gif
+++ /dev/null
Binary files differ
diff --git a/wp-admin/images/xit.gif b/wp-admin/images/xit.gif
new file mode 100644
index 0000000..6f1cc4f
--- /dev/null
+++ b/wp-admin/images/xit.gif
Binary files differ
diff --git a/wp-admin/includes/class-ftp-pure.php b/wp-admin/includes/class-ftp-pure.php
new file mode 100644
index 0000000..5ef92bf
--- /dev/null
+++ b/wp-admin/includes/class-ftp-pure.php
@@ -0,0 +1,175 @@
+<?php
+/**
+ * PemFTP - A Ftp implementation in pure PHP
+ *
+ * @package PemFTP
+ * @since 2.5
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
+ */
+class ftp extends ftp_base {
+
+ function ftp($verb=FALSE, $le=FALSE) {
+ $this->__construct($verb, $le);
+ }
+
+ function __construct($verb=FALSE, $le=FALSE) {
+ parent::__construct(false, $verb, $le);
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Private functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+ function _settimeout($sock) {
+ if(!@stream_set_timeout($sock, $this->_timeout)) {
+ $this->PushError('_settimeout','socket set send timeout');
+ $this->_quit();
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ function _connect($host, $port) {
+ $this->SendMSG("Creating socket");
+ $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout);
+ if (!$sock) {
+ $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")");
+ return FALSE;
+ }
+ $this->_connected=true;
+ return $sock;
+ }
+
+ function _readmsg($fnction="_readmsg"){
+ if(!$this->_connected) {
+ $this->PushError($fnction, 'Connect first');
+ return FALSE;
+ }
+ $result=true;
+ $this->_message="";
+ $this->_code=0;
+ $go=true;
+ do {
+ $tmp=@fgets($this->_ftp_control_sock, 512);
+ if($tmp===false) {
+ $go=$result=false;
+ $this->PushError($fnction,'Read failed');
+ } else {
+ $this->_message.=$tmp;
+ if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false;
+ }
+ } while($go);
+ if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
+ $this->_code=(int)$regs[1];
+ return $result;
+ }
+
+ function _exec($cmd, $fnction="_exec") {
+ if(!$this->_ready) {
+ $this->PushError($fnction,'Connect first');
+ return FALSE;
+ }
+ if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
+ $status=@fputs($this->_ftp_control_sock, $cmd.CRLF);
+ if($status===false) {
+ $this->PushError($fnction,'socket write failed');
+ return FALSE;
+ }
+ $this->_lastaction=time();
+ if(!$this->_readmsg($fnction)) return FALSE;
+ return TRUE;
+ }
+
+ function _data_prepare($mode=FTP_ASCII) {
+ if(!$this->_settype($mode)) return FALSE;
+ if($this->_passive) {
+ if(!$this->_exec("PASV", "pasv")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
+ $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
+ $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
+ if(!$this->_ftp_data_sock) {
+ $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")");
+ $this->_data_close();
+ return FALSE;
+ }
+ else $this->_ftp_data_sock;
+ } else {
+ $this->SendMSG("Only passive connections available!");
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ function _data_read($mode=FTP_ASCII, $fp=NULL) {
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Only passive connections available!");
+ return FALSE;
+ }
+ while (!feof($this->_ftp_data_sock)) {
+ $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size);
+ if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
+ if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
+ else $out.=$block;
+ }
+ return $out;
+ }
+
+ function _data_write($mode=FTP_ASCII, $fp=NULL) {
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Only passive connections available!");
+ return FALSE;
+ }
+ if(is_resource($fp)) {
+ while(!feof($fp)) {
+ $block=fread($fp, $this->_ftp_buff_size);
+ if(!$this->_data_write_block($mode, $block)) return false;
+ }
+ } elseif(!$this->_data_write_block($mode, $fp)) return false;
+ return TRUE;
+ }
+
+ function _data_write_block($mode, $block) {
+ if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
+ do {
+ if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) {
+ $this->PushError("_data_write","Can't write to socket");
+ return FALSE;
+ }
+ $block=substr($block, $t);
+ } while(!empty($block));
+ return true;
+ }
+
+ function _data_close() {
+ @fclose($this->_ftp_data_sock);
+ $this->SendMSG("Disconnected data from remote host");
+ return TRUE;
+ }
+
+ function _quit($force=FALSE) {
+ if($this->_connected or $force) {
+ @fclose($this->_ftp_control_sock);
+ $this->_connected=false;
+ $this->SendMSG("Socket closed");
+ }
+ }
+}
+?>
diff --git a/wp-admin/includes/class-ftp-sockets.php b/wp-admin/includes/class-ftp-sockets.php
new file mode 100644
index 0000000..99b4050
--- /dev/null
+++ b/wp-admin/includes/class-ftp-sockets.php
@@ -0,0 +1,236 @@
+<?php
+/**
+ * PemFTP - A Ftp implementation in pure PHP
+ *
+ * @package PemFTP
+ * @since 2.5
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
+ */
+class ftp extends ftp_base {
+
+ function ftp($verb=FALSE, $le=FALSE) {
+ $this->__construct($verb, $le);
+ }
+
+ function __construct($verb=FALSE, $le=FALSE) {
+ parent::__construct(true, $verb, $le);
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Private functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+ function _settimeout($sock) {
+ if(!@socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) {
+ $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock)));
+ @socket_close($sock);
+ return FALSE;
+ }
+ if(!@socket_set_option($sock, SOL_SOCKET , SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) {
+ $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock)));
+ @socket_close($sock);
+ return FALSE;
+ }
+ return true;
+ }
+
+ function _connect($host, $port) {
+ $this->SendMSG("Creating socket");
+ if(!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
+ $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock)));
+ return FALSE;
+ }
+ if(!$this->_settimeout($sock)) return FALSE;
+ $this->SendMSG("Connecting to \"".$host.":".$port."\"");
+ if (!($res = @socket_connect($sock, $host, $port))) {
+ $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock)));
+ @socket_close($sock);
+ return FALSE;
+ }
+ $this->_connected=true;
+ return $sock;
+ }
+
+ function _readmsg($fnction="_readmsg"){
+ if(!$this->_connected) {
+ $this->PushError($fnction,'Connect first');
+ return FALSE;
+ }
+ $result=true;
+ $this->_message="";
+ $this->_code=0;
+ $go=true;
+ do {
+ $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ);
+ if($tmp===false) {
+ $go=$result=false;
+ $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock)));
+ } else {
+ $this->_message.=$tmp;
+ $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs);
+ }
+ } while($go);
+ if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
+ $this->_code=(int)$regs[1];
+ return $result;
+ }
+
+ function _exec($cmd, $fnction="_exec") {
+ if(!$this->_ready) {
+ $this->PushError($fnction,'Connect first');
+ return FALSE;
+ }
+ if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
+ $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF);
+ if($status===false) {
+ $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream)));
+ return FALSE;
+ }
+ $this->_lastaction=time();
+ if(!$this->_readmsg($fnction)) return FALSE;
+ return TRUE;
+ }
+
+ function _data_prepare($mode=FTP_ASCII) {
+ if(!$this->_settype($mode)) return FALSE;
+ $this->SendMSG("Creating data socket");
+ $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ if ($this->_ftp_data_sock < 0) {
+ $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ return FALSE;
+ }
+ if(!$this->_settimeout($this->_ftp_data_sock)) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if($this->_passive) {
+ if(!$this->_exec("PASV", "pasv")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
+ $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
+ $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
+ $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ else $this->_ftp_temp_sock=$this->_ftp_data_sock;
+ } else {
+ if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) {
+ $this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!@socket_bind($this->_ftp_data_sock,$addr)){
+ $this->PushError("_data_prepare","can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!@socket_listen($this->_ftp_data_sock)) {
+ $this->PushError("_data_prepare","can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
+ $this->PushError("_data_prepare","can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }
+
+ function _data_read($mode=FTP_ASCII, $fp=NULL) {
+ $NewLine=$this->_eol_code[$this->OS_local];
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock);
+ if($this->_ftp_temp_sock===FALSE) {
+ $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ }
+
+ while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) {
+ if($block==="") break;
+ if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
+ if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
+ else $out.=$block;
+ }
+ return $out;
+ }
+
+ function _data_write($mode=FTP_ASCII, $fp=NULL) {
+ $NewLine=$this->_eol_code[$this->OS_local];
+ if(is_resource($fp)) $out=0;
+ else $out="";
+ if(!$this->_passive) {
+ $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
+ $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock);
+ if($this->_ftp_temp_sock===FALSE) {
+ $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ $this->_data_close();
+ return false;
+ }
+ }
+ if(is_resource($fp)) {
+ while(!feof($fp)) {
+ $block=fread($fp, $this->_ftp_buff_size);
+ if(!$this->_data_write_block($mode, $block)) return false;
+ }
+ } elseif(!$this->_data_write_block($mode, $fp)) return false;
+ return true;
+ }
+
+ function _data_write_block($mode, $block) {
+ if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
+ do {
+ if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) {
+ $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
+ $this->_data_close();
+ return FALSE;
+ }
+ $block=substr($block, $t);
+ } while(!empty($block));
+ return true;
+ }
+
+ function _data_close() {
+ @socket_close($this->_ftp_temp_sock);
+ @socket_close($this->_ftp_data_sock);
+ $this->SendMSG("Disconnected data from remote host");
+ return TRUE;
+ }
+
+ function _quit() {
+ if($this->_connected) {
+ @socket_close($this->_ftp_control_sock);
+ $this->_connected=false;
+ $this->SendMSG("Socket closed");
+ }
+ }
+}
+?>
diff --git a/wp-admin/includes/class-ftp.php b/wp-admin/includes/class-ftp.php
new file mode 100644
index 0000000..bc2720a
--- /dev/null
+++ b/wp-admin/includes/class-ftp.php
@@ -0,0 +1,842 @@
+<?php
+/**
+ * PemFTP - A Ftp implementation in pure PHP
+ *
+ * @package PemFTP
+ * @since 2.5
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
+ */
+if(!defined('CRLF')) define('CRLF',"\r\n");
+if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
+if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
+if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
+if(!defined('FTP_FORCE')) define('FTP_FORCE', TRUE);
+define('FTP_OS_Unix','u');
+define('FTP_OS_Windows','w');
+define('FTP_OS_Mac','m');
+
+class ftp_base {
+ /* Public variables */
+ var $LocalEcho;
+ var $Verbose;
+ var $OS_local;
+ var $OS_remote;
+
+ /* Private variables */
+ var $_lastaction;
+ var $_errors;
+ var $_type;
+ var $_umask;
+ var $_timeout;
+ var $_passive;
+ var $_host;
+ var $_fullhost;
+ var $_port;
+ var $_datahost;
+ var $_dataport;
+ var $_ftp_control_sock;
+ var $_ftp_data_sock;
+ var $_ftp_temp_sock;
+ var $_ftp_buff_size;
+ var $_login;
+ var $_password;
+ var $_connected;
+ var $_ready;
+ var $_code;
+ var $_message;
+ var $_can_restore;
+ var $_port_available;
+ var $_curtype;
+ var $_features;
+
+ var $_error_array;
+ var $AuthorizedTransferMode;
+ var $OS_FullName;
+ var $_eol_code;
+ var $AutoAsciiExt;
+
+ /* Constructor */
+ function ftp_base($port_mode=FALSE) {
+ $this->__construct($port_mode);
+ }
+
+ function __construct($port_mode=FALSE, $verb=FALSE, $le=FALSE) {
+ $this->LocalEcho=$le;
+ $this->Verbose=$verb;
+ $this->_lastaction=NULL;
+ $this->_error_array=array();
+ $this->_eol_code=array(FTP_OS_Unix=>"\n", FTP_OS_Mac=>"\r", FTP_OS_Windows=>"\r\n");
+ $this->AuthorizedTransferMode=array(FTP_AUTOASCII, FTP_ASCII, FTP_BINARY);
+ $this->OS_FullName=array(FTP_OS_Unix => 'UNIX', FTP_OS_Windows => 'WINDOWS', FTP_OS_Mac => 'MACOS');
+ $this->AutoAsciiExt=array("ASP","BAT","C","CPP","CSS","CSV","JS","H","HTM","HTML","SHTML","INI","LOG","PHP3","PHTML","PL","PERL","SH","SQL","TXT");
+ $this->_port_available=($port_mode==TRUE);
+ $this->SendMSG("Staring FTP client class".($this->_port_available?"":" without PORT mode support"));
+ $this->_connected=FALSE;
+ $this->_ready=FALSE;
+ $this->_can_restore=FALSE;
+ $this->_code=0;
+ $this->_message="";
+ $this->_ftp_buff_size=4096;
+ $this->_curtype=NULL;
+ $this->SetUmask(0022);
+ $this->SetType(FTP_AUTOASCII);
+ $this->SetTimeout(30);
+ $this->Passive(!$this->_port_available);
+ $this->_login="anonymous";
+ $this->_password="anon@ftp.com";
+ $this->_features=array();
+ $this->OS_local=FTP_OS_Unix;
+ $this->OS_remote=FTP_OS_Unix;
+ $this->features=array();
+ if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows;
+ elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac;
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Public functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+ function parselisting($line) {
+ $is_windows = ($this->OS_remote == FTP_OS_Windows);
+ if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
+ $b = array();
+ if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+ $b['isdir'] = ($lucifer[7]=="<DIR>");
+ if ( $b['isdir'] )
+ $b['type'] = 'd';
+ else
+ $b['type'] = 'f';
+ $b['size'] = $lucifer[7];
+ $b['month'] = $lucifer[1];
+ $b['day'] = $lucifer[2];
+ $b['year'] = $lucifer[3];
+ $b['hour'] = $lucifer[4];
+ $b['minute'] = $lucifer[5];
+ $b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);
+ $b['am/pm'] = $lucifer[6];
+ $b['name'] = $lucifer[8];
+ } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
+ //echo $line."\n";
+ $lcount=count($lucifer);
+ if ($lcount<8) return '';
+ $b = array();
+ $b['isdir'] = $lucifer[0]{0} === "d";
+ $b['islink'] = $lucifer[0]{0} === "l";
+ if ( $b['isdir'] )
+ $b['type'] = 'd';
+ elseif ( $b['islink'] )
+ $b['type'] = 'l';
+ else
+ $b['type'] = 'f';
+ $b['perms'] = $lucifer[0];
+ $b['number'] = $lucifer[1];
+ $b['owner'] = $lucifer[2];
+ $b['group'] = $lucifer[3];
+ $b['size'] = $lucifer[4];
+ if ($lcount==8) {
+ sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']);
+ sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']);
+ $b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']);
+ $b['name'] = $lucifer[7];
+ } else {
+ $b['month'] = $lucifer[5];
+ $b['day'] = $lucifer[6];
+ if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
+ $b['year'] = date("Y");
+ $b['hour'] = $l2[1];
+ $b['minute'] = $l2[2];
+ } else {
+ $b['year'] = $lucifer[7];
+ $b['hour'] = 0;
+ $b['minute'] = 0;
+ }
+ $b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));
+ $b['name'] = $lucifer[8];
+ }
+ }
+
+ return $b;
+ }
+
+ function SendMSG($message = "", $crlf=true) {
+ if ($this->Verbose) {
+ echo $message.($crlf?CRLF:"");
+ flush();
+ }
+ return TRUE;
+ }
+
+ function SetType($mode=FTP_AUTOASCII) {
+ if(!in_array($mode, $this->AuthorizedTransferMode)) {
+ $this->SendMSG("Wrong type");
+ return FALSE;
+ }
+ $this->_type=$mode;
+ $this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) );
+ return TRUE;
+ }
+
+ function _settype($mode=FTP_ASCII) {
+ if($this->_ready) {
+ if($mode==FTP_BINARY) {
+ if($this->_curtype!=FTP_BINARY) {
+ if(!$this->_exec("TYPE I", "SetType")) return FALSE;
+ $this->_curtype=FTP_BINARY;
+ }
+ } elseif($this->_curtype!=FTP_ASCII) {
+ if(!$this->_exec("TYPE A", "SetType")) return FALSE;
+ $this->_curtype=FTP_ASCII;
+ }
+ } else return FALSE;
+ return TRUE;
+ }
+
+ function Passive($pasv=NULL) {
+ if(is_null($pasv)) $this->_passive=!$this->_passive;
+ else $this->_passive=$pasv;
+ if(!$this->_port_available and !$this->_passive) {
+ $this->SendMSG("Only passive connections available!");
+ $this->_passive=TRUE;
+ return FALSE;
+ }
+ $this->SendMSG("Passive mode ".($this->_passive?"on":"off"));
+ return TRUE;
+ }
+
+ function SetServer($host, $port=21, $reconnect=true) {
+ if(!is_long($port)) {
+ $this->verbose=true;
+ $this->SendMSG("Incorrect port syntax");
+ return FALSE;
+ } else {
+ $ip=@gethostbyname($host);
+ $dns=@gethostbyaddr($host);
+ if(!$ip) $ip=$host;
+ if(!$dns) $dns=$host;
+ if(ip2long($ip) === -1) {
+ $this->SendMSG("Wrong host name/address \"".$host."\"");
+ return FALSE;
+ }
+ $this->_host=$ip;
+ $this->_fullhost=$dns;
+ $this->_port=$port;
+ $this->_dataport=$port-1;
+ }
+ $this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\"");
+ if($reconnect){
+ if($this->_connected) {
+ $this->SendMSG("Reconnecting");
+ if(!$this->quit(FTP_FORCE)) return FALSE;
+ if(!$this->connect()) return FALSE;
+ }
+ }
+ return TRUE;
+ }
+
+ function SetUmask($umask=0022) {
+ $this->_umask=$umask;
+ umask($this->_umask);
+ $this->SendMSG("UMASK 0".decoct($this->_umask));
+ return TRUE;
+ }
+
+ function SetTimeout($timeout=30) {
+ $this->_timeout=$timeout;
+ $this->SendMSG("Timeout ".$this->_timeout);
+ if($this->_connected)
+ if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
+ return TRUE;
+ }
+
+ function connect($server=NULL) {
+ if(!empty($server)) {
+ if(!$this->SetServer($server)) return false;
+ }
+ if($this->_ready) return true;
+ $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]);
+ if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
+ $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\"");
+ return FALSE;
+ }
+ $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting.");
+ do {
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $this->_lastaction=time();
+ } while($this->_code<200);
+ $this->_ready=true;
+ $syst=$this->systype();
+ if(!$syst) $this->SendMSG("Can't detect remote OS");
+ else {
+ if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows;
+ elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac;
+ elseif(preg_match("/(li|u)nix/i", $syst[0])) $this->OS_remote=FTP_OS_Unix;
+ else $this->OS_remote=FTP_OS_Mac;
+ $this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]);
+ }
+ if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled");
+ else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
+ return TRUE;
+ }
+
+ function quit($force=false) {
+ if($this->_ready) {
+ if(!$this->_exec("QUIT") and !$force) return FALSE;
+ if(!$this->_checkCode() and !$force) return FALSE;
+ $this->_ready=false;
+ $this->SendMSG("Session finished");
+ }
+ $this->_quit();
+ return TRUE;
+ }
+
+ function login($user=NULL, $pass=NULL) {
+ if(!is_null($user)) $this->_login=$user;
+ else $this->_login="anonymous";
+ if(!is_null($pass)) $this->_password=$pass;
+ else $this->_password="anon@anon.com";
+ if(!$this->_exec("USER ".$this->_login, "login")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ if($this->_code!=230) {
+ if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ }
+ $this->SendMSG("Authentication succeeded");
+ if(empty($this->_features)) {
+ if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled");
+ else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
+ }
+ return TRUE;
+ }
+
+ function pwd() {
+ if(!$this->_exec("PWD", "pwd")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return ereg_replace("^[0-9]{3} \"(.+)\" .+".CRLF, "\\1", $this->_message);
+ }
+
+ function cdup() {
+ if(!$this->_exec("CDUP", "cdup")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return true;
+ }
+
+ function chdir($pathname) {
+ if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function rmdir($pathname) {
+ if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function mkdir($pathname) {
+ if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function rename($from, $to) {
+ if(!$this->_exec("RNFR ".$from, "rename")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ if($this->_code==350) {
+ if(!$this->_exec("RNTO ".$to, "rename")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ } else return FALSE;
+ return TRUE;
+ }
+
+ function filesize($pathname) {
+ if(!isset($this->_features["SIZE"])) {
+ $this->PushError("filesize", "not supported by server");
+ return FALSE;
+ }
+ if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
+ }
+
+ function abort() {
+ if(!$this->_exec("ABOR", "abort")) return FALSE;
+ if(!$this->_checkCode()) {
+ if($this->_code!=426) return FALSE;
+ if(!$this->_readmsg("abort")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ }
+ return true;
+ }
+
+ function mdtm($pathname) {
+ if(!isset($this->_features["MDTM"])) {
+ $this->PushError("mdtm", "not supported by server");
+ return FALSE;
+ }
+ if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
+ $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
+ $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
+ return $timestamp;
+ }
+
+ function systype() {
+ if(!$this->_exec("SYST", "systype")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $DATA = explode(" ", $this->_message);
+ return array($DATA[1], $DATA[3]);
+ }
+
+ function delete($pathname) {
+ if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function site($command, $fnction="site") {
+ if(!$this->_exec("SITE ".$command, $fnction)) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function chmod($pathname, $mode) {
+ if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) return FALSE;
+ return TRUE;
+ }
+
+ function restore($from) {
+ if(!isset($this->_features["REST"])) {
+ $this->PushError("restore", "not supported by server");
+ return FALSE;
+ }
+ if($this->_curtype!=FTP_BINARY) {
+ $this->PushError("restore", "can't restore in ASCII mode");
+ return FALSE;
+ }
+ if(!$this->_exec("REST ".$from, "resore")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return TRUE;
+ }
+
+ function features() {
+ if(!$this->_exec("FEAT", "features")) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ $f=preg_split("/[".CRLF."]+/", preg_replace("/[0-9]{3}[ -].*[".CRLF."]+/", "", $this->_message), -1, PREG_SPLIT_NO_EMPTY);
+ $this->_features=array();
+ foreach($f as $k=>$v) {
+ $v=explode(" ", trim($v));
+ $this->_features[array_shift($v)]=$v;;
+ }
+ return true;
+ }
+
+ function rawlist($pathname="", $arg="") {
+ return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist");
+ }
+
+ function nlist($pathname="") {
+ return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist");
+ }
+
+ function is_exists($pathname) {
+ return $this->file_exists($pathname);
+ }
+
+ function file_exists($pathname) {
+ $exists=true;
+ if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE;
+ else {
+ if(!$this->_checkCode()) $exists=FALSE;
+ $this->abort();
+ }
+ if($exists) $this->SendMSG("Remote file ".$pathname." exists");
+ else $this->SendMSG("Remote file ".$pathname." does not exist");
+ return $exists;
+ }
+
+ function fget($fp, $remotefile,$rest=0) {
+ if($this->_can_restore and $rest!=0) fseek($fp, $rest);
+ $pi=pathinfo($remotefile);
+ if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
+ else $mode=FTP_BINARY;
+ if(!$this->_data_prepare($mode)) {
+ return FALSE;
+ }
+ if($this->_can_restore and $rest!=0) $this->restore($rest);
+ if(!$this->_exec("RETR ".$remotefile, "get")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $out=$this->_data_read($mode, $fp);
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return $out;
+ }
+
+ function get($remotefile, $localfile=NULL, $rest=0) {
+ if(is_null($localfile)) $localfile=$remotefile;
+ if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
+ $fp = @fopen($localfile, "w");
+ if (!$fp) {
+ $this->PushError("get","can't open local file", "Cannot create \"".$localfile."\"");
+ return FALSE;
+ }
+ if($this->_can_restore and $rest!=0) fseek($fp, $rest);
+ $pi=pathinfo($remotefile);
+ if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
+ else $mode=FTP_BINARY;
+ if(!$this->_data_prepare($mode)) {
+ fclose($fp);
+ return FALSE;
+ }
+ if($this->_can_restore and $rest!=0) $this->restore($rest);
+ if(!$this->_exec("RETR ".$remotefile, "get")) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ $out=$this->_data_read($mode, $fp);
+ fclose($fp);
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return $out;
+ }
+
+ function fput($remotefile, $fp) {
+ if($this->_can_restore and $rest!=0) fseek($fp, $rest);
+ $pi=pathinfo($remotefile);
+ if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
+ else $mode=FTP_BINARY;
+ if(!$this->_data_prepare($mode)) {
+ return FALSE;
+ }
+ if($this->_can_restore and $rest!=0) $this->restore($rest);
+ if(!$this->_exec("STOR ".$remotefile, "put")) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $ret=$this->_data_write($mode, $fp);
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return $ret;
+ }
+
+ function put($localfile, $remotefile=NULL, $rest=0) {
+ if(is_null($remotefile)) $remotefile=$localfile;
+ if (!file_exists($localfile)) {
+ $this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\"");
+ return FALSE;
+ }
+ $fp = @fopen($localfile, "r");
+
+ if (!$fp) {
+ $this->PushError("put","can't open local file", "Cannot read file \"".$localfile."\"");
+ return FALSE;
+ }
+ if($this->_can_restore and $rest!=0) fseek($fp, $rest);
+ $pi=pathinfo($localfile);
+ if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
+ else $mode=FTP_BINARY;
+ if(!$this->_data_prepare($mode)) {
+ fclose($fp);
+ return FALSE;
+ }
+ if($this->_can_restore and $rest!=0) $this->restore($rest);
+ if(!$this->_exec("STOR ".$remotefile, "put")) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ fclose($fp);
+ return FALSE;
+ }
+ $ret=$this->_data_write($mode, $fp);
+ fclose($fp);
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ return $ret;
+ }
+
+ function mput($local=".", $remote=NULL, $continious=false) {
+ $local=realpath($local);
+ if(!@file_exists($local)) {
+ $this->PushError("mput","can't open local folder", "Cannot stat folder \"".$local."\"");
+ return FALSE;
+ }
+ if(!is_dir($local)) return $this->put($local, $remote);
+ if(empty($remote)) $remote=".";
+ elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE;
+ if($handle = opendir($local)) {
+ $list=array();
+ while (false !== ($file = readdir($handle))) {
+ if ($file != "." && $file != "..") $list[]=$file;
+ }
+ closedir($handle);
+ } else {
+ $this->PushError("mput","can't open local folder", "Cannot read folder \"".$local."\"");
+ return FALSE;
+ }
+ if(empty($list)) return TRUE;
+ $ret=true;
+ foreach($list as $el) {
+ if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el);
+ else $t=$this->put($local."/".$el, $remote."/".$el);
+ if(!$t) {
+ $ret=FALSE;
+ if(!$continious) break;
+ }
+ }
+ return $ret;
+
+ }
+
+ function mget($remote, $local=".", $continious=false) {
+ $list=$this->rawlist($remote, "-lA");
+ if($list===false) {
+ $this->PushError("mget","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
+ return FALSE;
+ }
+ if(empty($list)) return true;
+ if(!@file_exists($local)) {
+ if(!@mkdir($local)) {
+ $this->PushError("mget","can't create local folder", "Cannot create folder \"".$local."\"");
+ return FALSE;
+ }
+ }
+ foreach($list as $k=>$v) {
+ $list[$k]=$this->parselisting($v);
+ if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
+ }
+ $ret=true;
+ foreach($list as $el) {
+ if($el["type"]=="d") {
+ if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) {
+ $this->PushError("mget", "can't copy folder", "Can't copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
+ $ret=false;
+ if(!$continious) break;
+ }
+ } else {
+ if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) {
+ $this->PushError("mget", "can't copy file", "Can't copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
+ $ret=false;
+ if(!$continious) break;
+ }
+ }
+ @chmod($local."/".$el["name"], $el["perms"]);
+ $t=strtotime($el["date"]);
+ if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t);
+ }
+ return $ret;
+ }
+
+ function mdel($remote, $continious=false) {
+ $list=$this->rawlist($remote, "-la");
+ if($list===false) {
+ $this->PushError("mdel","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
+ return false;
+ }
+
+ foreach($list as $k=>$v) {
+ $list[$k]=$this->parselisting($v);
+ if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
+ }
+ $ret=true;
+
+ foreach($list as $el) {
+ if ( empty($el) )
+ continue;
+
+ if($el["type"]=="d") {
+ if(!$this->mdel($remote."/".$el["name"], $continious)) {
+ $ret=false;
+ if(!$continious) break;
+ }
+ } else {
+ if (!$this->delete($remote."/".$el["name"])) {
+ $this->PushError("mdel", "can't delete file", "Can't delete remote file \"".$remote."/".$el["name"]."\"");
+ $ret=false;
+ if(!$continious) break;
+ }
+ }
+ }
+
+ if(!$this->rmdir($remote)) {
+ $this->PushError("mdel", "can't delete folder", "Can't delete remote folder \"".$remote."/".$el["name"]."\"");
+ $ret=false;
+ }
+ return $ret;
+ }
+
+ function mmkdir($dir, $mode = 0777) {
+ if(empty($dir)) return FALSE;
+ if($this->is_exists($dir) or $dir == "/" ) return TRUE;
+ if(!$this->mmkdir(dirname($dir), $mode)) return false;
+ $r=$this->mkdir($dir, $mode);
+ $this->chmod($dir,$mode);
+ return $r;
+ }
+
+ function glob($pattern, $handle=NULL) {
+ $path=$output=null;
+ if(PHP_OS=='WIN32') $slash='\\';
+ else $slash='/';
+ $lastpos=strrpos($pattern,$slash);
+ if(!($lastpos===false)) {
+ $path=substr($pattern,0,-$lastpos-1);
+ $pattern=substr($pattern,$lastpos);
+ } else $path=getcwd();
+ if(is_array($handle) and !empty($handle)) {
+ while($dir=each($handle)) {
+ if($this->glob_pattern_match($pattern,$dir))
+ $output[]=$dir;
+ }
+ } else {
+ $handle=@opendir($path);
+ if($handle===false) return false;
+ while($dir=readdir($handle)) {
+ if($this->glob_pattern_match($pattern,$dir))
+ $output[]=$dir;
+ }
+ closedir($handle);
+ }
+ if(is_array($output)) return $output;
+ return false;
+ }
+
+ function glob_pattern_match($pattern,$string) {
+ $out=null;
+ $chunks=explode(';',$pattern);
+ foreach($chunks as $pattern) {
+ $escape=array('$','^','.','{','}','(',')','[',']','|');
+ while(strpos($pattern,'**')!==false)
+ $pattern=str_replace('**','*',$pattern);
+ foreach($escape as $probe)
+ $pattern=str_replace($probe,"\\$probe",$pattern);
+ $pattern=str_replace('?*','*',
+ str_replace('*?','*',
+ str_replace('*',".*",
+ str_replace('?','.{1,1}',$pattern))));
+ $out[]=$pattern;
+ }
+ if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string));
+ else {
+ foreach($out as $tester)
+ if($this->my_regexp("^$tester$",$string)) return true;
+ }
+ return false;
+ }
+
+ function glob_regexp($pattern,$probe) {
+ $sensitive=(PHP_OS!='WIN32');
+ return ($sensitive?
+ ereg($pattern,$probe):
+ eregi($pattern,$probe)
+ );
+ }
+
+ function dirlist($remote) {
+ $list=$this->rawlist($remote, "-la");
+ if($list===false) {
+ $this->PushError("dirlist","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
+ return false;
+ }
+
+ $dirlist = array();
+ foreach($list as $k=>$v) {
+ $entry=$this->parselisting($v);
+ if ( empty($entry) )
+ continue;
+
+ if($entry["name"]=="." or $entry["name"]=="..")
+ continue;
+
+ $dirlist[$entry['name']] = $entry;
+ }
+
+ return $dirlist;
+ }
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Private functions -->
+// <!-- --------------------------------------------------------------------------------------- -->
+ function _checkCode() {
+ return ($this->_code<400 and $this->_code>0);
+ }
+
+ function _list($arg="", $cmd="LIST", $fnction="_list") {
+ if(!$this->_data_prepare()) return false;
+ if(!$this->_exec($cmd.$arg, $fnction)) {
+ $this->_data_close();
+ return FALSE;
+ }
+ if(!$this->_checkCode()) {
+ $this->_data_close();
+ return FALSE;
+ }
+ $out="";
+ if($this->_code<200) {
+ $out=$this->_data_read();
+ $this->_data_close();
+ if(!$this->_readmsg()) return FALSE;
+ if(!$this->_checkCode()) return FALSE;
+ if($out === FALSE ) return FALSE;
+ $out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY);
+// $this->SendMSG(implode($this->_eol_code[$this->OS_local], $out));
+ }
+ return $out;
+ }
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Partie : gestion des erreurs -->
+// <!-- --------------------------------------------------------------------------------------- -->
+// Gnre une erreur pour traitement externe la classe
+ function PushError($fctname,$msg,$desc=false){
+ $error=array();
+ $error['time']=time();
+ $error['fctname']=$fctname;
+ $error['msg']=$msg;
+ $error['desc']=$desc;
+ if($desc) $tmp=' ('.$desc.')'; else $tmp='';
+ $this->SendMSG($fctname.': '.$msg.$tmp);
+ return(array_push($this->_error_array,$error));
+ }
+
+// Rcupre une erreur externe
+ function PopError(){
+ if(count($this->_error_array)) return(array_pop($this->_error_array));
+ else return(false);
+ }
+}
+
+$mod_sockets=TRUE;
+if (!extension_loaded('sockets')) {
+ $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
+ if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
+}
+require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
+?>
diff --git a/wp-admin/includes/class-pclzip.php b/wp-admin/includes/class-pclzip.php
new file mode 100644
index 0000000..d387f00
--- /dev/null
+++ b/wp-admin/includes/class-pclzip.php
@@ -0,0 +1,5748 @@
+<?php
+// --------------------------------------------------------------------------------
+// PhpConcept Library - Zip Module 2.5
+// --------------------------------------------------------------------------------
+// License GNU/LGPL - Vincent Blavet - March 2006
+// http://www.phpconcept.net
+// --------------------------------------------------------------------------------
+//
+// Presentation :
+// PclZip is a PHP library that manage ZIP archives.
+// So far tests show that archives generated by PclZip are readable by
+// WinZip application and other tools.
+//
+// Description :
+// See readme.txt and http://www.phpconcept.net
+//
+// Warning :
+// This library and the associated files are non commercial, non professional
+// work.
+// It should not have unexpected results. However if any damage is caused by
+// this software the author can not be responsible.
+// The use of this software is at the risk of the user.
+//
+// --------------------------------------------------------------------------------
+// $Id: pclzip.lib.php,v 1.44 2006/03/08 21:23:59 vblavet Exp $
+// --------------------------------------------------------------------------------
+
+ // ----- Constants
+ define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
+
+ // ----- File list separator
+ // In version 1.x of PclZip, the separator for file list is a space
+ // (which is not a very smart choice, specifically for windows paths !).
+ // A better separator should be a comma (,). This constant gives you the
+ // abilty to change that.
+ // However notice that changing this value, may have impact on existing
+ // scripts, using space separated filenames.
+ // Recommanded values for compatibility with older versions :
+ //define( 'PCLZIP_SEPARATOR', ' ' );
+ // Recommanded values for smart separation of filenames.
+ define( 'PCLZIP_SEPARATOR', ',' );
+
+ // ----- Error configuration
+ // 0 : PclZip Class integrated error handling
+ // 1 : PclError external library error handling. By enabling this
+ // you must ensure that you have included PclError library.
+ // [2,...] : reserved for futur use
+ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+
+ // ----- Optional static temporary directory
+ // By default temporary files are generated in the script current
+ // path.
+ // If defined :
+ // - MUST BE terminated by a '/'.
+ // - MUST be a valid, already created directory
+ // Samples :
+ // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
+ // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
+ define( 'PCLZIP_TEMPORARY_DIR', '' );
+
+// --------------------------------------------------------------------------------
+// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
+// --------------------------------------------------------------------------------
+
+ // ----- Global variables
+ $g_pclzip_version = "2.5";
+
+ // ----- Error codes
+ // -1 : Unable to open file in binary write mode
+ // -2 : Unable to open file in binary read mode
+ // -3 : Invalid parameters
+ // -4 : File does not exist
+ // -5 : Filename is too long (max. 255)
+ // -6 : Not a valid zip file
+ // -7 : Invalid extracted file size
+ // -8 : Unable to create directory
+ // -9 : Invalid archive extension
+ // -10 : Invalid archive format
+ // -11 : Unable to delete file (unlink)
+ // -12 : Unable to rename file (rename)
+ // -13 : Invalid header checksum
+ // -14 : Invalid archive size
+ define( 'PCLZIP_ERR_USER_ABORTED', 2 );
+ define( 'PCLZIP_ERR_NO_ERROR', 0 );
+ define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
+ define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
+ define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
+ define( 'PCLZIP_ERR_MISSING_FILE', -4 );
+ define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
+ define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
+ define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
+ define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
+ define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
+ define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
+ define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
+ define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
+ define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
+ define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
+ define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
+ define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
+ define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
+ define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
+ define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
+ define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
+ define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
+
+ // ----- Options values
+ define( 'PCLZIP_OPT_PATH', 77001 );
+ define( 'PCLZIP_OPT_ADD_PATH', 77002 );
+ define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
+ define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
+ define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
+ define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
+ define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
+ define( 'PCLZIP_OPT_BY_NAME', 77008 );
+ define( 'PCLZIP_OPT_BY_INDEX', 77009 );
+ define( 'PCLZIP_OPT_BY_EREG', 77010 );
+ define( 'PCLZIP_OPT_BY_PREG', 77011 );
+ define( 'PCLZIP_OPT_COMMENT', 77012 );
+ define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
+ define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
+ define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
+ define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
+ define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
+ // Having big trouble with crypt. Need to multiply 2 long int
+ // which is not correctly supported by PHP ...
+ //define( 'PCLZIP_OPT_CRYPT', 77018 );
+ define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
+
+ // ----- File description attributes
+ define( 'PCLZIP_ATT_FILE_NAME', 79001 );
+ define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
+ define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
+
+ // ----- Call backs values
+ define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
+ define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
+ define( 'PCLZIP_CB_PRE_ADD', 78003 );
+ define( 'PCLZIP_CB_POST_ADD', 78004 );
+ /* For futur use
+ define( 'PCLZIP_CB_PRE_LIST', 78005 );
+ define( 'PCLZIP_CB_POST_LIST', 78006 );
+ define( 'PCLZIP_CB_PRE_DELETE', 78007 );
+ define( 'PCLZIP_CB_POST_DELETE', 78008 );
+ */
+
+ // --------------------------------------------------------------------------------
+ // Class : PclZip
+ // Description :
+ // PclZip is the class that represent a Zip archive.
+ // The public methods allow the manipulation of the archive.
+ // Attributes :
+ // Attributes must not be accessed directly.
+ // Methods :
+ // PclZip() : Object creator
+ // create() : Creates the Zip archive
+ // listContent() : List the content of the Zip archive
+ // extract() : Extract the content of the archive
+ // properties() : List the properties of the archive
+ // --------------------------------------------------------------------------------
+ class PclZip
+ {
+ // ----- Filename of the zip file
+ var $zipname = '';
+
+ // ----- File descriptor of the zip file
+ var $zip_fd = 0;
+
+ // ----- Internal error handling
+ var $error_code = 1;
+ var $error_string = '';
+
+ // ----- Current status of the magic_quotes_runtime
+ // This value store the php configuration for magic_quotes
+ // The class can then disable the magic_quotes and reset it after
+ var $magic_quotes_status;
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZip()
+ // Description :
+ // Creates a PclZip object and set the name of the associated Zip archive
+ // filename.
+ // Note that no real action is taken, if the archive does not exist it is not
+ // created. Use create() for that.
+ // --------------------------------------------------------------------------------
+ function PclZip($p_zipname)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");
+
+ // ----- Tests the zlib
+ if (!function_exists('gzopen'))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
+ die('Abort '.basename(__FILE__).' : Missing zlib extensions');
+ }
+
+ // ----- Set the attributes
+ $this->zipname = $p_zipname;
+ $this->zip_fd = 0;
+ $this->magic_quotes_status = -1;
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
+ return;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // create($p_filelist, $p_add_dir="", $p_remove_dir="")
+ // create($p_filelist, $p_option, $p_option_value, ...)
+ // Description :
+ // This method supports two different synopsis. The first one is historical.
+ // This method creates a Zip Archive. The Zip file is created in the
+ // filesystem. The files and directories indicated in $p_filelist
+ // are added in the archive. See the parameters description for the
+ // supported format of $p_filelist.
+ // When a directory is in the list, the directory and its content is added
+ // in the archive.
+ // In this synopsis, the function takes an optional variable list of
+ // options. See bellow the supported options.
+ // Parameters :
+ // $p_filelist : An array containing file or directory names, or
+ // a string containing one filename or one directory name, or
+ // a string containing a list of filenames and/or directory
+ // names separated by spaces.
+ // $p_add_dir : A path to add before the real path of the archived file,
+ // in order to have it memorized in the archive.
+ // $p_remove_dir : A path to remove from the real path of the file to archive,
+ // in order to have a shorter path memorized in the archive.
+ // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+ // is removed first, before $p_add_dir is added.
+ // Options :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_OPT_COMMENT :
+ // PCLZIP_CB_PRE_ADD :
+ // PCLZIP_CB_POST_ADD :
+ // Return Values :
+ // 0 on failure,
+ // The list of the added files, with a status of the add action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ function create($p_filelist)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Set default values
+ $v_options = array();
+ $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
+
+ // ----- Look for arguments
+ if ($v_size > 1) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Remove from the options list the first argument
+ array_shift($v_arg_list);
+ $v_size--;
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
+
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+ array (PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_ADD => 'optional',
+ PCLZIP_CB_POST_ADD => 'optional',
+ PCLZIP_OPT_NO_COMPRESSION => 'optional',
+ PCLZIP_OPT_COMMENT => 'optional'
+ //, PCLZIP_OPT_CRYPT => 'optional'
+ ));
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+ }
+
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
+
+ // ----- Get the first argument
+ $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
+ }
+ else if ($v_size > 2) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+ "Invalid number / type of arguments");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return 0;
+ }
+ }
+ }
+
+ // ----- Init
+ $v_string_list = array();
+ $v_att_list = array();
+ $v_filedescr_list = array();
+ $p_result_list = array();
+
+ // ----- Look if the $p_filelist is really an array
+ if (is_array($p_filelist)) {
+
+ // ----- Look if the first element is also an array
+ // This will mean that this is a file description entry
+ if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
+ $v_att_list = $p_filelist;
+ }
+
+ // ----- The list is a list of string names
+ else {
+ $v_string_list = $p_filelist;
+ }
+ }
+
+ // ----- Look if the $p_filelist is a string
+ else if (is_string($p_filelist)) {
+ // ----- Create a list from the string
+ $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+ }
+
+ // ----- Invalid variable type for $p_filelist
+ else {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Reformat the string list
+ if (sizeof($v_string_list) != 0) {
+ foreach ($v_string_list as $v_string) {
+ if ($v_string != '') {
+ $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");
+ }
+ }
+ }
+
+ // ----- For each file in the list check the attributes
+ $v_supported_attributes
+ = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
+ ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
+ ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
+ );
+ foreach ($v_att_list as $v_entry) {
+ $v_result = $this->privFileDescrParseAtt($v_entry,
+ $v_filedescr_list[],
+ $v_options,
+ $v_supported_attributes);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+ }
+
+ // ----- Expand the filelist (expand directories)
+ $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Call the create fct
+ $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
+ return $p_result_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // add($p_filelist, $p_add_dir="", $p_remove_dir="")
+ // add($p_filelist, $p_option, $p_option_value, ...)
+ // Description :
+ // This method supports two synopsis. The first one is historical.
+ // This methods add the list of files in an existing archive.
+ // If a file with the same name already exists, it is added at the end of the
+ // archive, the first one is still present.
+ // If the archive does not exist, it is created.
+ // Parameters :
+ // $p_filelist : An array containing file or directory names, or
+ // a string containing one filename or one directory name, or
+ // a string containing a list of filenames and/or directory
+ // names separated by spaces.
+ // $p_add_dir : A path to add before the real path of the archived file,
+ // in order to have it memorized in the archive.
+ // $p_remove_dir : A path to remove from the real path of the file to archive,
+ // in order to have a shorter path memorized in the archive.
+ // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+ // is removed first, before $p_add_dir is added.
+ // Options :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_OPT_COMMENT :
+ // PCLZIP_OPT_ADD_COMMENT :
+ // PCLZIP_OPT_PREPEND_COMMENT :
+ // PCLZIP_CB_PRE_ADD :
+ // PCLZIP_CB_POST_ADD :
+ // Return Values :
+ // 0 on failure,
+ // The list of the added files, with a status of the add action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ function add($p_filelist)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Set default values
+ $v_options = array();
+ $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
+
+ // ----- Look for arguments
+ if ($v_size > 1) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Remove form the options list the first argument
+ array_shift($v_arg_list);
+ $v_size--;
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
+
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+ array (PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_ADD => 'optional',
+ PCLZIP_CB_POST_ADD => 'optional',
+ PCLZIP_OPT_NO_COMPRESSION => 'optional',
+ PCLZIP_OPT_COMMENT => 'optional',
+ PCLZIP_OPT_ADD_COMMENT => 'optional',
+ PCLZIP_OPT_PREPEND_COMMENT => 'optional'
+ //, PCLZIP_OPT_CRYPT => 'optional'
+ ));
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+ }
+
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
+
+ // ----- Get the first argument
+ $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
+ }
+ else if ($v_size > 2) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return 0;
+ }
+ }
+ }
+
+ // ----- Init
+ $v_string_list = array();
+ $v_att_list = array();
+ $v_filedescr_list = array();
+ $p_result_list = array();
+
+ // ----- Look if the $p_filelist is really an array
+ if (is_array($p_filelist)) {
+
+ // ----- Look if the first element is also an array
+ // This will mean that this is a file description entry
+ if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
+ $v_att_list = $p_filelist;
+ }
+
+ // ----- The list is a list of string names
+ else {
+ $v_string_list = $p_filelist;
+ }
+ }
+
+ // ----- Look if the $p_filelist is a string
+ else if (is_string($p_filelist)) {
+ // ----- Create a list from the string
+ $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+ }
+
+ // ----- Invalid variable type for $p_filelist
+ else {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Reformat the string list
+ if (sizeof($v_string_list) != 0) {
+ foreach ($v_string_list as $v_string) {
+ $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
+ }
+ }
+
+ // ----- For each file in the list check the attributes
+ $v_supported_attributes
+ = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
+ ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
+ ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
+ );
+ foreach ($v_att_list as $v_entry) {
+ $v_result = $this->privFileDescrParseAtt($v_entry,
+ $v_filedescr_list[],
+ $v_options,
+ $v_supported_attributes);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+ }
+
+ // ----- Expand the filelist (expand directories)
+ $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Call the create fct
+ $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
+ return $p_result_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : listContent()
+ // Description :
+ // This public method, gives the list of the files and directories, with their
+ // properties.
+ // The properties of each entries in the list are (used also in other functions) :
+ // filename : Name of the file. For a create or add action it is the filename
+ // given by the user. For an extract function it is the filename
+ // of the extracted file.
+ // stored_filename : Name of the file / directory stored in the archive.
+ // size : Size of the stored file.
+ // compressed_size : Size of the file's data compressed in the archive
+ // (without the headers overhead)
+ // mtime : Last known modification date of the file (UNIX timestamp)
+ // comment : Comment associated with the file
+ // folder : true | false
+ // index : index of the file in the archive
+ // status : status of the action (depending of the action) :
+ // Values are :
+ // ok : OK !
+ // filtered : the file / dir is not extracted (filtered by user)
+ // already_a_directory : the file can not be extracted because a
+ // directory with the same name already exists
+ // write_protected : the file can not be extracted because a file
+ // with the same name already exists and is
+ // write protected
+ // newer_exist : the file was not extracted because a newer file exists
+ // path_creation_fail : the file is not extracted because the folder
+ // does not exists and can not be created
+ // write_error : the file was not extracted because there was a
+ // error while writing the file
+ // read_error : the file was not extracted because there was a error
+ // while reading the file
+ // invalid_header : the file was not extracted because of an archive
+ // format error (bad file header)
+ // Note that each time a method can continue operating when there
+ // is an action error on a file, the error is only logged in the file status.
+ // Return Values :
+ // 0 on an unrecoverable failure,
+ // The list of the files in the archive.
+ // --------------------------------------------------------------------------------
+ function listContent()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return(0);
+ }
+
+ // ----- Call the extracting fct
+ $p_list = array();
+ if (($v_result = $this->privList($p_list)) != 1)
+ {
+ unset($p_list);
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
+ return(0);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // extract($p_path="./", $p_remove_path="")
+ // extract([$p_option, $p_option_value, ...])
+ // Description :
+ // This method supports two synopsis. The first one is historical.
+ // This method extract all the files / directories from the archive to the
+ // folder indicated in $p_path.
+ // If you want to ignore the 'root' part of path of the memorized files
+ // you can indicate this in the optional $p_remove_path parameter.
+ // By default, if a newer file with the same name already exists, the
+ // file is not extracted.
+ //
+ // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
+ // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
+ // at the end of the path value of PCLZIP_OPT_PATH.
+ // Parameters :
+ // $p_path : Path where the files and directories are to be extracted
+ // $p_remove_path : First part ('root' part) of the memorized path
+ // (if any similar) to remove while extracting.
+ // Options :
+ // PCLZIP_OPT_PATH :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_CB_PRE_EXTRACT :
+ // PCLZIP_CB_POST_EXTRACT :
+ // Return Values :
+ // 0 or a negative value on failure,
+ // The list of the extracted files, with a status of the action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ function extract()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return(0);
+ }
+
+ // ----- Set default values
+ $v_options = array();
+// $v_path = "./";
+ $v_path = '';
+ $v_remove_path = "";
+ $v_remove_all_path = false;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
+
+ // ----- Default values for option
+ $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+
+ // ----- Look for arguments
+ if ($v_size > 0) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
+
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+ array (PCLZIP_OPT_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_EXTRACT => 'optional',
+ PCLZIP_CB_POST_EXTRACT => 'optional',
+ PCLZIP_OPT_SET_CHMOD => 'optional',
+ PCLZIP_OPT_BY_NAME => 'optional',
+ PCLZIP_OPT_BY_EREG => 'optional',
+ PCLZIP_OPT_BY_PREG => 'optional',
+ PCLZIP_OPT_BY_INDEX => 'optional',
+ PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+ PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
+ PCLZIP_OPT_REPLACE_NEWER => 'optional'
+ ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
+ ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
+ ));
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Set the arguments
+ if (isset($v_options[PCLZIP_OPT_PATH])) {
+ $v_path = $v_options[PCLZIP_OPT_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+ $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+ $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+ // ----- Check for '/' in last path char
+ if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+ $v_path .= '/';
+ }
+ $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+ }
+ }
+
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
+
+ // ----- Get the first argument
+ $v_path = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_remove_path = $v_arg_list[1];
+ }
+ else if ($v_size > 2) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
+ return 0;
+ }
+ }
+ }
+
+ // ----- Trace
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
+
+ // ----- Call the extracting fct
+ $p_list = array();
+ $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
+ $v_remove_all_path, $v_options);
+ if ($v_result < 1) {
+ unset($p_list);
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
+ return(0);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // extractByIndex($p_index, $p_path="./", $p_remove_path="")
+ // extractByIndex($p_index, [$p_option, $p_option_value, ...])
+ // Description :
+ // This method supports two synopsis. The first one is historical.
+ // This method is doing a partial extract of the archive.
+ // The extracted files or folders are identified by their index in the
+ // archive (from 0 to n).
+ // Note that if the index identify a folder, only the folder entry is
+ // extracted, not all the files included in the archive.
+ // Parameters :
+ // $p_index : A single index (integer) or a string of indexes of files to
+ // extract. The form of the string is "0,4-6,8-12" with only numbers
+ // and '-' for range or ',' to separate ranges. No spaces or ';'
+ // are allowed.
+ // $p_path : Path where the files and directories are to be extracted
+ // $p_remove_path : First part ('root' part) of the memorized path
+ // (if any similar) to remove while extracting.
+ // Options :
+ // PCLZIP_OPT_PATH :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
+ // not as files.
+ // The resulting content is in a new field 'content' in the file
+ // structure.
+ // This option must be used alone (any other options are ignored).
+ // PCLZIP_CB_PRE_EXTRACT :
+ // PCLZIP_CB_POST_EXTRACT :
+ // Return Values :
+ // 0 on failure,
+ // The list of the extracted files, with a status of the action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ //function extractByIndex($p_index, options...)
+ function extractByIndex($p_index)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return(0);
+ }
+
+ // ----- Set default values
+ $v_options = array();
+// $v_path = "./";
+ $v_path = '';
+ $v_remove_path = "";
+ $v_remove_all_path = false;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
+
+ // ----- Default values for option
+ $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+
+ // ----- Look for arguments
+ if ($v_size > 1) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Remove form the options list the first argument
+ array_shift($v_arg_list);
+ $v_size--;
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
+
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+ array (PCLZIP_OPT_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_EXTRACT => 'optional',
+ PCLZIP_CB_POST_EXTRACT => 'optional',
+ PCLZIP_OPT_SET_CHMOD => 'optional',
+ PCLZIP_OPT_REPLACE_NEWER => 'optional'
+ ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
+ ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
+ ));
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Set the arguments
+ if (isset($v_options[PCLZIP_OPT_PATH])) {
+ $v_path = $v_options[PCLZIP_OPT_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+ $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+ $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+ // ----- Check for '/' in last path char
+ if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+ $v_path .= '/';
+ }
+ $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+ }
+ if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
+ $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
+ }
+ }
+
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
+
+ // ----- Get the first argument
+ $v_path = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_remove_path = $v_arg_list[1];
+ }
+ else if ($v_size > 2) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return 0;
+ }
+ }
+ }
+
+ // ----- Trace
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
+
+ // ----- Trick
+ // Here I want to reuse extractByRule(), so I need to parse the $p_index
+ // with privParseOptions()
+ $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
+ $v_options_trick = array();
+ $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
+ array (PCLZIP_OPT_BY_INDEX => 'optional' ));
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+ $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
+
+ // ----- Call the extracting fct
+ if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
+ return(0);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // delete([$p_option, $p_option_value, ...])
+ // Description :
+ // This method removes files from the archive.
+ // If no parameters are given, then all the archive is emptied.
+ // Parameters :
+ // None or optional arguments.
+ // Options :
+ // PCLZIP_OPT_BY_INDEX :
+ // PCLZIP_OPT_BY_NAME :
+ // PCLZIP_OPT_BY_EREG :
+ // PCLZIP_OPT_BY_PREG :
+ // Return Values :
+ // 0 on failure,
+ // The list of the files which are still present in the archive.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ function delete()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return(0);
+ }
+
+ // ----- Set default values
+ $v_options = array();
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
+
+ // ----- Look for arguments
+ if ($v_size > 0) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+ array (PCLZIP_OPT_BY_NAME => 'optional',
+ PCLZIP_OPT_BY_EREG => 'optional',
+ PCLZIP_OPT_BY_PREG => 'optional',
+ PCLZIP_OPT_BY_INDEX => 'optional' ));
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+ }
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Call the delete fct
+ $v_list = array();
+ if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
+ $this->privSwapBackMagicQuotes();
+ unset($v_list);
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
+ return(0);
+ }
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
+ return $v_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : deleteByIndex()
+ // Description :
+ // ***** Deprecated *****
+ // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
+ // --------------------------------------------------------------------------------
+ function deleteByIndex($p_index)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
+
+ $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : properties()
+ // Description :
+ // This method gives the properties of the archive.
+ // The properties are :
+ // nb : Number of files in the archive
+ // comment : Comment associated with the archive file
+ // status : not_exist, ok
+ // Parameters :
+ // None
+ // Return Values :
+ // 0 on failure,
+ // An array with the archive properties.
+ // --------------------------------------------------------------------------------
+ function properties()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return(0);
+ }
+
+ // ----- Default properties
+ $v_prop = array();
+ $v_prop['comment'] = '';
+ $v_prop['nb'] = 0;
+ $v_prop['status'] = 'not_exist';
+
+ // ----- Look if file exists
+ if (@is_file($this->zipname))
+ {
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
+ {
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
+ return 0;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+ {
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return 0;
+ }
+
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ // ----- Set the user attributes
+ $v_prop['comment'] = $v_central_dir['comment'];
+ $v_prop['nb'] = $v_central_dir['entries'];
+ $v_prop['status'] = 'ok';
+ }
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
+ return $v_prop;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : duplicate()
+ // Description :
+ // This method creates an archive by copying the content of an other one. If
+ // the archive already exist, it is replaced by the new one without any warning.
+ // Parameters :
+ // $p_archive : The filename of a valid archive, or
+ // a valid PclZip object.
+ // Return Values :
+ // 1 on success.
+ // 0 or a negative value on error (error code).
+ // --------------------------------------------------------------------------------
+ function duplicate($p_archive)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
+ $v_result = 1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Look if the $p_archive is a PclZip object
+ if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");
+
+ // ----- Duplicate the archive
+ $v_result = $this->privDuplicate($p_archive->zipname);
+ }
+
+ // ----- Look if the $p_archive is a string (so a filename)
+ else if (is_string($p_archive))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");
+
+ // ----- Check that $p_archive is a valid zip file
+ // TBC : Should also check the archive format
+ if (!is_file($p_archive)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
+ $v_result = PCLZIP_ERR_MISSING_FILE;
+ }
+ else {
+ // ----- Duplicate the archive
+ $v_result = $this->privDuplicate($p_archive);
+ }
+ }
+
+ // ----- Invalid variable
+ else
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
+ $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : merge()
+ // Description :
+ // This method merge the $p_archive_to_add archive at the end of the current
+ // one ($this).
+ // If the archive ($this) does not exist, the merge becomes a duplicate.
+ // If the $p_archive_to_add archive does not exist, the merge is a success.
+ // Parameters :
+ // $p_archive_to_add : It can be directly the filename of a valid zip archive,
+ // or a PclZip object archive.
+ // Return Values :
+ // 1 on success,
+ // 0 or negative values on error (see below).
+ // --------------------------------------------------------------------------------
+ function merge($p_archive_to_add)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
+ $v_result = 1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+ return(0);
+ }
+
+ // ----- Look if the $p_archive_to_add is a PclZip object
+ if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");
+
+ // ----- Merge the archive
+ $v_result = $this->privMerge($p_archive_to_add);
+ }
+
+ // ----- Look if the $p_archive_to_add is a string (so a filename)
+ else if (is_string($p_archive_to_add))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");
+
+ // ----- Create a temporary archive
+ $v_object_archive = new PclZip($p_archive_to_add);
+
+ // ----- Merge the archive
+ $v_result = $this->privMerge($v_object_archive);
+ }
+
+ // ----- Invalid variable
+ else
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
+ $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+
+
+ // --------------------------------------------------------------------------------
+ // Function : errorCode()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function errorCode()
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ return(PclErrorCode());
+ }
+ else {
+ return($this->error_code);
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : errorName()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function errorName($p_with_code=false)
+ {
+ $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
+ PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
+ PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
+ PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
+ PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
+ PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
+ PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
+ PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
+ PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
+ PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
+ PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
+ PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
+ PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
+ PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
+ PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
+ PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
+ PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
+ PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
+ PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
+ ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
+ ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
+ );
+
+ if (isset($v_name[$this->error_code])) {
+ $v_value = $v_name[$this->error_code];
+ }
+ else {
+ $v_value = 'NoName';
+ }
+
+ if ($p_with_code) {
+ return($v_value.' ('.$this->error_code.')');
+ }
+ else {
+ return($v_value);
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : errorInfo()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function errorInfo($p_full=false)
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ return(PclErrorString());
+ }
+ else {
+ if ($p_full) {
+ return($this->errorName(true)." : ".$this->error_string);
+ }
+ else {
+ return($this->error_string." [code ".$this->error_code."]");
+ }
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+
+// --------------------------------------------------------------------------------
+// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
+// ***** *****
+// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY *****
+// --------------------------------------------------------------------------------
+
+
+
+ // --------------------------------------------------------------------------------
+ // Function : privCheckFormat()
+ // Description :
+ // This method check that the archive exists and is a valid zip archive.
+ // Several level of check exists. (futur)
+ // Parameters :
+ // $p_level : Level of check. Default 0.
+ // 0 : Check the first bytes (magic codes) (default value))
+ // 1 : 0 + Check the central directory (futur)
+ // 2 : 1 + Check each file header (futur)
+ // Return Values :
+ // true on success,
+ // false on error, the error code is set.
+ // --------------------------------------------------------------------------------
+ function privCheckFormat($p_level=0)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
+ $v_result = true;
+
+ // ----- Reset the file system cache
+ clearstatcache();
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Look if the file exits
+ if (!is_file($this->zipname)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
+ return(false);
+ }
+
+ // ----- Check that the file is readeable
+ if (!is_readable($this->zipname)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
+ return(false);
+ }
+
+ // ----- Check the magic code
+ // TBC
+
+ // ----- Check the central header
+ // TBC
+
+ // ----- Check each file header
+ // TBC
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privParseOptions()
+ // Description :
+ // This internal methods reads the variable list of arguments ($p_options_list,
+ // $p_size) and generate an array with the options and values ($v_result_list).
+ // $v_requested_options contains the options that can be present and those that
+ // must be present.
+ // $v_requested_options is an array, with the option value as key, and 'optional',
+ // or 'mandatory' as value.
+ // Parameters :
+ // See above.
+ // Return Values :
+ // 1 on success.
+ // 0 on failure.
+ // --------------------------------------------------------------------------------
+ function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
+ $v_result=1;
+
+ // ----- Read the options
+ $i=0;
+ while ($i<$p_size) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
+
+ // ----- Check if the option is supported
+ if (!isset($v_requested_options[$p_options_list[$i]])) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for next option
+ switch ($p_options_list[$i]) {
+ // ----- Look for options that request a path value
+ case PCLZIP_OPT_PATH :
+ case PCLZIP_OPT_REMOVE_PATH :
+ case PCLZIP_OPT_ADD_PATH :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ $i++;
+ break;
+
+ case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if ( is_string($p_options_list[$i+1])
+ && ($p_options_list[$i+1] != '')) {
+ $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ $i++;
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
+ }
+ break;
+
+ // ----- Look for options that request an array of string for value
+ case PCLZIP_OPT_BY_NAME :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
+ }
+ else if (is_array($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ }
+ else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ $i++;
+ break;
+
+ // ----- Look for options that request an EREG or PREG expression
+ case PCLZIP_OPT_BY_EREG :
+ case PCLZIP_OPT_BY_PREG :
+ //case PCLZIP_OPT_CRYPT :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ }
+ else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ $i++;
+ break;
+
+ // ----- Look for options that takes a string
+ case PCLZIP_OPT_COMMENT :
+ case PCLZIP_OPT_ADD_COMMENT :
+ case PCLZIP_OPT_PREPEND_COMMENT :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
+ "Missing parameter value for option '"
+ .PclZipUtilOptionText($p_options_list[$i])
+ ."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ }
+ else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
+ "Wrong parameter value for option '"
+ .PclZipUtilOptionText($p_options_list[$i])
+ ."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ $i++;
+ break;
+
+ // ----- Look for options that request an array of index
+ case PCLZIP_OPT_BY_INDEX :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_work_list = array();
+ if (is_string($p_options_list[$i+1])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");
+
+ // ----- Remove spaces
+ $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
+
+ // ----- Parse items
+ $v_work_list = explode(",", $p_options_list[$i+1]);
+ }
+ else if (is_integer($p_options_list[$i+1])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
+ $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
+ }
+ else if (is_array($p_options_list[$i+1])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
+ $v_work_list = $p_options_list[$i+1];
+ }
+ else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Reduce the index list
+ // each index item in the list must be a couple with a start and
+ // an end value : [0,3], [5-5], [8-10], ...
+ // ----- Check the format of each item
+ $v_sort_flag=false;
+ $v_sort_value=0;
+ for ($j=0; $j<sizeof($v_work_list); $j++) {
+ // ----- Explode the item
+ $v_item_list = explode("-", $v_work_list[$j]);
+ $v_size_item_list = sizeof($v_item_list);
+
+ // ----- TBC : Here we might check that each item is a
+ // real integer ...
+
+ // ----- Look for single value
+ if ($v_size_item_list == 1) {
+ // ----- Set the option value
+ $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
+ $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
+ }
+ elseif ($v_size_item_list == 2) {
+ // ----- Set the option value
+ $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
+ $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
+ }
+ else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");
+
+ // ----- Look for list sort
+ if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
+ $v_sort_flag=true;
+
+ // ----- TBC : An automatic sort should be writen ...
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
+ }
+
+ // ----- Sort the items
+ if ($v_sort_flag) {
+ // TBC : To Be Completed
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
+ }
+
+ // ----- Next option
+ $i++;
+ break;
+
+ // ----- Look for options that request no value
+ case PCLZIP_OPT_REMOVE_ALL_PATH :
+ case PCLZIP_OPT_EXTRACT_AS_STRING :
+ case PCLZIP_OPT_NO_COMPRESSION :
+ case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
+ case PCLZIP_OPT_REPLACE_NEWER :
+ case PCLZIP_OPT_STOP_ON_ERROR :
+ $v_result_list[$p_options_list[$i]] = true;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ break;
+
+ // ----- Look for options that request an octal value
+ case PCLZIP_OPT_SET_CHMOD :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+ $i++;
+ break;
+
+ // ----- Look for options that request a call-back
+ case PCLZIP_CB_PRE_EXTRACT :
+ case PCLZIP_CB_POST_EXTRACT :
+ case PCLZIP_CB_PRE_ADD :
+ case PCLZIP_CB_POST_ADD :
+ /* for futur use
+ case PCLZIP_CB_PRE_DELETE :
+ case PCLZIP_CB_POST_DELETE :
+ case PCLZIP_CB_PRE_LIST :
+ case PCLZIP_CB_POST_LIST :
+ */
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_function_name = $p_options_list[$i+1];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");
+
+ // ----- Check that the value is a valid existing function
+ if (!function_exists($v_function_name)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Set the attribute
+ $v_result_list[$p_options_list[$i]] = $v_function_name;
+ $i++;
+ break;
+
+ default :
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+ "Unknown parameter '"
+ .$p_options_list[$i]."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Next options
+ $i++;
+ }
+
+ // ----- Look for mandatory options
+ if ($v_requested_options !== false) {
+ for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
+ // ----- Look for mandatory option
+ if ($v_requested_options[$key] == 'mandatory') {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
+ // ----- Look if present
+ if (!isset($v_result_list[$key])) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+ }
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privFileDescrParseAtt()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // 1 on success.
+ // 0 on failure.
+ // --------------------------------------------------------------------------------
+ function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
+ $v_result=1;
+
+ // ----- For each file in the list check the attributes
+ foreach ($p_file_list as $v_key => $v_value) {
+
+ // ----- Check if the option is supported
+ if (!isset($v_requested_options[$v_key])) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for attribute
+ switch ($v_key) {
+ case PCLZIP_ATT_FILE_NAME :
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
+
+ if ($p_filedescr['filename'] == '') {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ break;
+
+ case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
+
+ if ($p_filedescr['new_short_name'] == '') {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ break;
+
+ case PCLZIP_ATT_FILE_NEW_FULL_NAME :
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
+
+ if ($p_filedescr['new_full_name'] == '') {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ break;
+
+ default :
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+ "Unknown parameter '".$v_key."'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for mandatory options
+ if ($v_requested_options !== false) {
+ for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
+ // ----- Look for mandatory option
+ if ($v_requested_options[$key] == 'mandatory') {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
+ // ----- Look if present
+ if (!isset($p_file_list[$key])) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+ }
+ }
+
+ // end foreach
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privFileDescrExpand()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // 1 on success.
+ // 0 on failure.
+ // --------------------------------------------------------------------------------
+ function privFileDescrExpand(&$p_filedescr_list, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
+ $v_result=1;
+
+ // ----- Create a result list
+ $v_result_list = array();
+
+ // ----- Look each entry
+ for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
+ // ----- Get filedescr
+ $v_descr = $p_filedescr_list[$i];
+
+ // ----- Reduce the filename
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
+ $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']);
+ $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
+
+ // ----- Get type of descr
+ if (!file_exists($v_descr['filename'])) {
+ // ----- Error log
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exists");
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exists");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ if (@is_file($v_descr['filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
+ $v_descr['type'] = 'file';
+ }
+ else if (@is_dir($v_descr['filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
+ $v_descr['type'] = 'folder';
+ }
+ else if (@is_link($v_descr['filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
+ // skip
+ continue;
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
+ // skip
+ continue;
+ }
+
+ // ----- Calculate the stored filename
+ $this->privCalculateStoredFilename($v_descr, $p_options);
+
+ // ----- Add the descriptor in result list
+ $v_result_list[sizeof($v_result_list)] = $v_descr;
+
+ // ----- Look for folder
+ if ($v_descr['type'] == 'folder') {
+ // ----- List of items in folder
+ $v_dirlist_descr = array();
+ $v_dirlist_nb = 0;
+ if ($v_folder_handler = @opendir($v_descr['filename'])) {
+ while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");
+
+ // ----- Skip '.' and '..'
+ if (($v_item_handler == '.') || ($v_item_handler == '..')) {
+ continue;
+ }
+
+ // ----- Compose the full filename
+ $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
+
+ // ----- Look for different stored filename
+ // Because the name of the folder was changed, the name of the
+ // files/sub-folders also change
+ if ($v_descr['stored_filename'] != $v_descr['filename']) {
+ $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
+ }
+
+ $v_dirlist_nb++;
+ }
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
+ // TBC : unable to open folder in read mode
+ }
+
+ // ----- Expand each element of the list
+ if ($v_dirlist_nb != 0) {
+ // ----- Expand
+ if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Concat the resulting list
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
+ $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
+ }
+
+ // ----- Free local array
+ unset($v_dirlist_descr);
+ }
+ }
+
+ // ----- Get the result list
+ $p_filedescr_list = $v_result_list;
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCreate()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
+ $v_result=1;
+ $v_list_detail = array();
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Open the file in write mode
+ if (($v_result = $this->privOpenFd('wb')) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Add the list of files
+ $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
+
+ // ----- Close
+ $this->privCloseFd();
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAdd()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");
+ $v_result=1;
+ $v_list_detail = array();
+
+ // ----- Look if the archive exists or is empty
+ if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");
+
+ // ----- Do a create
+ $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_result=$this->privOpenFd('rb')) != 1)
+ {
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+ {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
+
+ // ----- Creates a temporay file
+ $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+ // ----- Open the temporary file in write mode
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
+ {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Copy the files from the archive to the temporary file
+ // TBC : Here I should better append the file and go back to erase the central dir
+ $v_size = $v_central_dir['offset'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = fread($this->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Swap the file descriptor
+ // Here is a trick : I swap the temporary fd with the zip fd, in order to use
+ // the following methods on the temporary fil and not the real archive
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Add the files
+ $v_header_list = array();
+ if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
+ {
+ fclose($v_zip_temp_fd);
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
+
+ // ----- Copy the block of file headers from the old archive
+ $v_size = $v_central_dir['size'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
+ @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Create the Central Dir files header
+ for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
+ {
+ // ----- Create the file header
+ if ($v_header_list[$i]['status'] == 'ok') {
+ if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+ fclose($v_zip_temp_fd);
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ $v_count++;
+ }
+
+ // ----- Transform the header to a 'usable' info
+ $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+ }
+
+ // ----- Zip file comment
+ $v_comment = $v_central_dir['comment'];
+ if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+ }
+ if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
+ $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
+ }
+ if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
+ }
+
+ // ----- Calculate the size of the central header
+ $v_size = @ftell($this->zip_fd)-$v_offset;
+
+ // ----- Create the central dir footer
+ if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
+ {
+ // ----- Reset the file list
+ unset($v_header_list);
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Swap back the file descriptor
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Close
+ $this->privCloseFd();
+
+ // ----- Close the temporary file
+ @fclose($v_zip_temp_fd);
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Delete the zip file
+ // TBC : I should test the result ...
+ @unlink($this->zipname);
+
+ // ----- Rename the temporary file
+ // TBC : I should test the result ...
+ //@rename($v_zip_temp_name, $this->zipname);
+ PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privOpenFd()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function privOpenFd($p_mode)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
+ $v_result=1;
+
+ // ----- Look if already open
+ if ($this->zip_fd != 0)
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
+ if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCloseFd()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function privCloseFd()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
+ $v_result=1;
+
+ if ($this->zip_fd != 0)
+ @fclose($this->zip_fd);
+ $this->zip_fd = 0;
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddList()
+ // Description :
+ // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
+ // different from the real path of the file. This is usefull if you want to have PclTar
+ // running in any directory, and memorize relative path from an other directory.
+ // Parameters :
+ // $p_list : An array containing the file or directory names to add in the tar
+ // $p_result_list : list of added files with their properties (specially the status field)
+ // $p_add_dir : Path to add in the filename path archived
+ // $p_remove_dir : Path to remove in the filename path archived
+ // Return Values :
+ // --------------------------------------------------------------------------------
+// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
+ function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");
+ $v_result=1;
+
+ // ----- Add the files
+ $v_header_list = array();
+ if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($this->zip_fd);
+
+ // ----- Create the Central Dir files header
+ for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
+ {
+ // ----- Create the file header
+ if ($v_header_list[$i]['status'] == 'ok') {
+ if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ $v_count++;
+ }
+
+ // ----- Transform the header to a 'usable' info
+ $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+ }
+
+ // ----- Zip file comment
+ $v_comment = '';
+ if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+ }
+
+ // ----- Calculate the size of the central header
+ $v_size = @ftell($this->zip_fd)-$v_offset;
+
+ // ----- Create the central dir footer
+ if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
+ {
+ // ----- Reset the file list
+ unset($v_header_list);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddFileList()
+ // Description :
+ // Parameters :
+ // $p_filedescr_list : An array containing the file description
+ // or directory names to add in the zip
+ // $p_result_list : list of added files with their properties (specially the status field)
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
+ $v_result=1;
+ $v_header = array();
+
+ // ----- Recuperate the current number of elt in list
+ $v_nb = sizeof($p_result_list);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");
+
+ // ----- Loop on the files
+ for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
+ // ----- Format the filename
+ $p_filedescr_list[$j]['filename']
+ = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
+
+ // ----- Skip empty file names
+ // TBC : Can this be possible ? not checked in DescrParseAtt ?
+ if ($p_filedescr_list[$j]['filename'] == "") {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
+ continue;
+ }
+
+ // ----- Check the filename
+ if (!file_exists($p_filedescr_list[$j]['filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Look if it is a file or a dir with no all path remove option
+ if ( (is_file($p_filedescr_list[$j]['filename']))
+ || ( is_dir($p_filedescr_list[$j]['filename'])
+ && ( !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
+ || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
+
+ // ----- Add the file
+ $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
+ $p_options);
+ if ($v_result != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Store the file infos
+ $p_result_list[$v_nb++] = $v_header;
+ }
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddFile()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privAddFile($p_filedescr, &$p_header, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
+ $v_result=1;
+
+ // ----- Working variable
+ $p_filename = $p_filedescr['filename'];
+
+ // TBC : Already done in the fileAtt check ... ?
+ if ($p_filename == "") {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for a stored different filename
+ if (isset($p_filedescr['stored_filename'])) {
+ $v_stored_filename = $p_filedescr['stored_filename'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
+ }
+ else {
+ $v_stored_filename = $p_filedescr['stored_filename'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
+ }
+
+ // ----- Set the file properties
+ clearstatcache();
+ $p_header['version'] = 20;
+ $p_header['version_extracted'] = 10;
+ $p_header['flag'] = 0;
+ $p_header['compression'] = 0;
+ $p_header['mtime'] = filemtime($p_filename);
+ $p_header['crc'] = 0;
+ $p_header['compressed_size'] = 0;
+ $p_header['size'] = filesize($p_filename);
+ $p_header['filename_len'] = strlen($p_filename);
+ $p_header['extra_len'] = 0;
+ $p_header['comment_len'] = 0;
+ $p_header['disk'] = 0;
+ $p_header['internal'] = 0;
+// $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
+ $p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
+ $p_header['offset'] = 0;
+ $p_header['filename'] = $p_filename;
+ $p_header['stored_filename'] = $v_stored_filename;
+ $p_header['extra'] = '';
+ $p_header['comment'] = '';
+ $p_header['status'] = 'ok';
+ $p_header['index'] = -1;
+
+ // ----- Look for pre-add callback
+ if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_header['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
+ $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
+ }
+ }
+
+ // ----- Look for empty stored filename
+ if ($p_header['stored_filename'] == "") {
+ $p_header['status'] = "filtered";
+ }
+
+ // ----- Check the path length
+ if (strlen($p_header['stored_filename']) > 0xFF) {
+ $p_header['status'] = 'filename_too_long';
+ }
+
+ // ----- Look if no error, or file not skipped
+ if ($p_header['status'] == 'ok') {
+
+ // ----- Look for a file
+ if (is_file($p_filename))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
+ // ----- Open the source file
+ if (($v_file = @fopen($p_filename, "rb")) == 0) {
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
+ // ----- Read the file content
+ $v_content_compressed = @fread($v_file, $p_header['size']);
+
+ // ----- Calculate the CRC
+ $p_header['crc'] = @crc32($v_content_compressed);
+
+ // ----- Set header parameters
+ $p_header['compressed_size'] = $p_header['size'];
+ $p_header['compression'] = 0;
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
+ // ----- Read the file content
+ $v_content = @fread($v_file, $p_header['size']);
+
+ // ----- Calculate the CRC
+ $p_header['crc'] = @crc32($v_content);
+
+ // ----- Compress the file
+ $v_content_compressed = @gzdeflate($v_content);
+
+ // ----- Set header parameters
+ $p_header['compressed_size'] = strlen($v_content_compressed);
+ $p_header['compression'] = 8;
+ }
+
+ // ----- Look for encryption
+ /*
+ if ((isset($p_options[PCLZIP_OPT_CRYPT]))
+ && ($p_options[PCLZIP_OPT_CRYPT] != "")) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");
+
+ // Should be a random header
+ $v_header = 'xxxxxxxxxxxx';
+ $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,
+ $p_header['compressed_size'],
+ $v_header,
+ $p_header['crc'],
+ "test");
+
+ $p_header['compressed_size'] += 12;
+ $p_header['flag'] = 1;
+
+ // ----- Add the header to the data
+ $v_content_compressed = $v_header.$v_content_compressed;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");
+ }
+ */
+
+ // ----- Call the header generation
+ if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+ @fclose($v_file);
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Write the compressed (or not) content
+ @fwrite($this->zip_fd,
+ $v_content_compressed, $p_header['compressed_size']);
+
+ // ----- Close the file
+ @fclose($v_file);
+ }
+
+ // ----- Look for a directory
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
+ // ----- Look for directory last '/'
+ if (@substr($p_header['stored_filename'], -1) != '/') {
+ $p_header['stored_filename'] .= '/';
+ }
+
+ // ----- Set the file properties
+ $p_header['size'] = 0;
+ //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked
+ $p_header['external'] = 0x00000010; // Value for a folder : to be checked
+
+ // ----- Call the header generation
+ if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ }
+ }
+
+ // ----- Look for post-add callback
+ if (isset($p_options[PCLZIP_CB_POST_ADD])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
+ if ($v_result == 0) {
+ // ----- Ignored
+ $v_result = 1;
+ }
+
+ // ----- Update the informations
+ // Nothing can be modified
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCalculateStoredFilename()
+ // Description :
+ // Based on file descriptor properties and global options, this method
+ // calculate the filename that will be stored in the archive.
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privCalculateStoredFilename(&$p_filedescr, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
+ $v_result=1;
+
+ // ----- Working variables
+ $p_filename = $p_filedescr['filename'];
+ if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
+ $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
+ }
+ else {
+ $p_add_dir = '';
+ }
+ if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
+ $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
+ }
+ else {
+ $p_remove_dir = '';
+ }
+ if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+ $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+ }
+ else {
+ $p_remove_all_dir = 0;
+ }
+
+ // ----- Look for full name change
+ if (isset($p_filedescr['new_full_name'])) {
+ $v_stored_filename = $p_filedescr['new_full_name'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
+ }
+
+ // ----- Look for path and/or short name change
+ else {
+
+ // ----- Look for short name change
+ if (isset($p_filedescr['new_short_name'])) {
+ $v_path_info = pathinfo($p_filename);
+ $v_dir = '';
+ if ($v_path_info['dirname'] != '') {
+ $v_dir = $v_path_info['dirname'].'/';
+ }
+ $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
+ }
+ else {
+ // ----- Calculate the stored filename
+ $v_stored_filename = $p_filename;
+ }
+
+ // ----- Look for all path to remove
+ if ($p_remove_all_dir) {
+ $v_stored_filename = basename($p_filename);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
+ }
+ // ----- Look for partial path remove
+ else if ($p_remove_dir != "") {
+ if (substr($p_remove_dir, -1) != '/')
+ $p_remove_dir .= "/";
+
+ if ( (substr($p_filename, 0, 2) == "./")
+ || (substr($p_remove_dir, 0, 2) == "./")) {
+
+ if ( (substr($p_filename, 0, 2) == "./")
+ && (substr($p_remove_dir, 0, 2) != "./")) {
+ $p_remove_dir = "./".$p_remove_dir;
+ }
+ if ( (substr($p_filename, 0, 2) != "./")
+ && (substr($p_remove_dir, 0, 2) == "./")) {
+ $p_remove_dir = substr($p_remove_dir, 2);
+ }
+ }
+
+ $v_compare = PclZipUtilPathInclusion($p_remove_dir,
+ $v_stored_filename);
+ if ($v_compare > 0) {
+ if ($v_compare == 2) {
+ $v_stored_filename = "";
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
+ $v_stored_filename = substr($v_stored_filename,
+ strlen($p_remove_dir));
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
+ }
+ }
+ }
+ // ----- Look for path to add
+ if ($p_add_dir != "") {
+ if (substr($p_add_dir, -1) == "/")
+ $v_stored_filename = $p_add_dir.$v_stored_filename;
+ else
+ $v_stored_filename = $p_add_dir."/".$v_stored_filename;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
+ }
+ }
+
+ // ----- Filename (reduce the path of stored name)
+ $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
+ $p_filedescr['stored_filename'] = $v_stored_filename;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privWriteFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privWriteFileHeader(&$p_header)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
+ $v_result=1;
+
+ // ----- Store the offset position of the file
+ $p_header['offset'] = ftell($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);
+
+ // ----- Transform UNIX mtime to DOS format mdate/mtime
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+ $v_date = getdate($p_header['mtime']);
+ $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+ $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+ // ----- Packed data
+ $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
+ $p_header['version_extracted'], $p_header['flag'],
+ $p_header['compression'], $v_mtime, $v_mdate,
+ $p_header['crc'], $p_header['compressed_size'],
+ $p_header['size'],
+ strlen($p_header['stored_filename']),
+ $p_header['extra_len']);
+
+ // ----- Write the first 148 bytes of the header in the archive
+ fputs($this->zip_fd, $v_binary_data, 30);
+
+ // ----- Write the variable fields
+ if (strlen($p_header['stored_filename']) != 0)
+ {
+ fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
+ }
+ if ($p_header['extra_len'] != 0)
+ {
+ fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privWriteCentralFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privWriteCentralFileHeader(&$p_header)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
+ $v_result=1;
+
+ // TBC
+ //for(reset($p_header); $key = key($p_header); next($p_header)) {
+ // //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
+ //}
+
+ // ----- Transform UNIX mtime to DOS format mdate/mtime
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+ $v_date = getdate($p_header['mtime']);
+ $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+ $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+ // ----- Packed data
+ $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
+ $p_header['version'], $p_header['version_extracted'],
+ $p_header['flag'], $p_header['compression'],
+ $v_mtime, $v_mdate, $p_header['crc'],
+ $p_header['compressed_size'], $p_header['size'],
+ strlen($p_header['stored_filename']),
+ $p_header['extra_len'], $p_header['comment_len'],
+ $p_header['disk'], $p_header['internal'],
+ $p_header['external'], $p_header['offset']);
+
+ // ----- Write the 42 bytes of the header in the zip file
+ fputs($this->zip_fd, $v_binary_data, 46);
+
+ // ----- Write the variable fields
+ if (strlen($p_header['stored_filename']) != 0)
+ {
+ fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
+ }
+ if ($p_header['extra_len'] != 0)
+ {
+ fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+ }
+ if ($p_header['comment_len'] != 0)
+ {
+ fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privWriteCentralHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
+ $v_result=1;
+
+ // ----- Packed data
+ $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
+ $p_nb_entries, $p_size,
+ $p_offset, strlen($p_comment));
+
+ // ----- Write the 22 bytes of the header in the zip file
+ fputs($this->zip_fd, $v_binary_data, 22);
+
+ // ----- Write the variable fields
+ if (strlen($p_comment) != 0)
+ {
+ fputs($this->zip_fd, $p_comment, strlen($p_comment));
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privList()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privList(&$p_list)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
+ $v_result=1;
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
+ {
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+ {
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Go to beginning of Central Dir
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
+ if (@fseek($this->zip_fd, $v_central_dir['offset']))
+ {
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
+
+ // ----- Read each entry
+ for ($i=0; $i<$v_central_dir['entries']; $i++)
+ {
+ // ----- Read the file header
+ if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
+ {
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ $v_header['index'] = $i;
+
+ // ----- Get the only interesting attributes
+ $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
+ unset($v_header);
+ }
+
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privConvertHeader2FileInfo()
+ // Description :
+ // This function takes the file informations from the central directory
+ // entries and extract the interesting parameters that will be given back.
+ // The resulting file infos are set in the array $p_info
+ // $p_info['filename'] : Filename with full path. Given by user (add),
+ // extracted in the filesystem (extract).
+ // $p_info['stored_filename'] : Stored filename in the archive.
+ // $p_info['size'] = Size of the file.
+ // $p_info['compressed_size'] = Compressed size of the file.
+ // $p_info['mtime'] = Last modification date of the file.
+ // $p_info['comment'] = Comment associated with the file.
+ // $p_info['folder'] = true/false : indicates if the entry is a folder or not.
+ // $p_info['status'] = status of the action on the file.
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privConvertHeader2FileInfo($p_header, &$p_info)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
+ $v_result=1;
+
+ // ----- Get the interesting attributes
+ $p_info['filename'] = $p_header['filename'];
+ $p_info['stored_filename'] = $p_header['stored_filename'];
+ $p_info['size'] = $p_header['size'];
+ $p_info['compressed_size'] = $p_header['compressed_size'];
+ $p_info['mtime'] = $p_header['mtime'];
+ $p_info['comment'] = $p_header['comment'];
+ $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
+ $p_info['index'] = $p_header['index'];
+ $p_info['status'] = $p_header['status'];
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractByRule()
+ // Description :
+ // Extract a file or directory depending of rules (by index, by name, ...)
+ // Parameters :
+ // $p_file_list : An array where will be placed the properties of each
+ // extracted file
+ // $p_path : Path to add while writing the extracted files
+ // $p_remove_path : Path to remove (from the file memorized path) while writing the
+ // extracted files. If the path does not match the file path,
+ // the file is extracted with its memorized path.
+ // $p_remove_path does not apply to 'list' mode.
+ // $p_path and $p_remove_path are commulative.
+ // Return Values :
+ // 1 on success,0 or less on error (see error code list)
+ // --------------------------------------------------------------------------------
+ function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
+ $v_result=1;
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Check the path
+ if ( ($p_path == "")
+ || ( (substr($p_path, 0, 1) != "/")
+ && (substr($p_path, 0, 3) != "../")
+ && (substr($p_path,1,2)!=":/")))
+ $p_path = "./".$p_path;
+
+ // ----- Reduce the path last (and duplicated) '/'
+ if (($p_path != "./") && ($p_path != "/"))
+ {
+ // ----- Look for the path end '/'
+ while (substr($p_path, -1) == "/")
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
+ $p_path = substr($p_path, 0, strlen($p_path)-1);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
+ }
+ }
+
+ // ----- Look for path to remove format (should end by /)
+ if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
+ {
+ $p_remove_path .= '/';
+ }
+ $p_remove_path_size = strlen($p_remove_path);
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_result = $this->privOpenFd('rb')) != 1)
+ {
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Start at beginning of Central Dir
+ $v_pos_entry = $v_central_dir['offset'];
+
+ // ----- Read each entry
+ $j_start = 0;
+ for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");
+
+ // ----- Read next Central dir entry
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
+ if (@fseek($this->zip_fd, $v_pos_entry))
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");
+
+ // ----- Read the file header
+ $v_header = array();
+ if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Store the index
+ $v_header['index'] = $i;
+
+ // ----- Store the file position
+ $v_pos_entry = ftell($this->zip_fd);
+
+ // ----- Look for the specific extract rules
+ $v_extract = false;
+
+ // ----- Look for extract by name rule
+ if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
+ && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
+
+ // ----- Look if the filename is in the list
+ for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
+
+ // ----- Look for a directory
+ if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
+
+ // ----- Look if the directory is in the filename path
+ if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
+ && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
+ $v_extract = true;
+ }
+ }
+ // ----- Look for a filename
+ elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
+ $v_extract = true;
+ }
+ }
+ }
+
+ // ----- Look for extract by ereg rule
+ else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
+ && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
+
+ if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
+ $v_extract = true;
+ }
+ }
+
+ // ----- Look for extract by preg rule
+ else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
+ && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
+
+ if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
+ $v_extract = true;
+ }
+ }
+
+ // ----- Look for extract by index rule
+ else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
+ && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
+
+ // ----- Look if the index is in the list
+ for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
+
+ if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
+ $v_extract = true;
+ }
+ if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
+ $j_start = $j+1;
+ }
+
+ if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
+ break;
+ }
+ }
+ }
+
+ // ----- Look for no rule, which means extract all the archive
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
+ $v_extract = true;
+ }
+
+ // ----- Check compression method
+ if ( ($v_extract)
+ && ( ($v_header['compression'] != 8)
+ && ($v_header['compression'] != 0))) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
+ $v_header['status'] = 'unsupported_compression';
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
+
+ $this->privSwapBackMagicQuotes();
+
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
+ "Filename '".$v_header['stored_filename']."' is "
+ ."compressed by an unsupported compression "
+ ."method (".$v_header['compression'].") ");
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Check encrypted files
+ if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
+ $v_header['status'] = 'unsupported_encryption';
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
+
+ $this->privSwapBackMagicQuotes();
+
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
+ "Unsupported encryption for "
+ ." filename '".$v_header['stored_filename']
+ ."'");
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Look for real extraction
+ if (($v_extract) && ($v_header['status'] != 'ok')) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
+ $v_result = $this->privConvertHeader2FileInfo($v_header,
+ $p_file_list[$v_nb_extracted++]);
+ if ($v_result != 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ $v_extract = false;
+ }
+
+ // ----- Look for real extraction
+ if ($v_extract)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");
+
+ // ----- Go to the file position
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
+ if (@fseek($this->zip_fd, $v_header['offset']))
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
+
+ // ----- Look for extraction as string
+ if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
+
+ // ----- Extracting the file
+ $v_result1 = $this->privExtractFileAsString($v_header, $v_string);
+ if ($v_result1 < 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
+ return $v_result1;
+ }
+
+ // ----- Get the only interesting attributes
+ if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Set the file content
+ $p_file_list[$v_nb_extracted]['content'] = $v_string;
+
+ // ----- Next extracted file
+ $v_nb_extracted++;
+
+ // ----- Look for user callback abort
+ if ($v_result1 == 2) {
+ break;
+ }
+ }
+ // ----- Look for extraction in standard output
+ elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
+ && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
+ // ----- Extracting the file in standard output
+ $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
+ if ($v_result1 < 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
+ return $v_result1;
+ }
+
+ // ----- Get the only interesting attributes
+ if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Look for user callback abort
+ if ($v_result1 == 2) {
+ break;
+ }
+ }
+ // ----- Look for normal extraction
+ else {
+ // ----- Extracting the file
+ $v_result1 = $this->privExtractFile($v_header,
+ $p_path, $p_remove_path,
+ $p_remove_all_path,
+ $p_options);
+ if ($v_result1 < 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
+ return $v_result1;
+ }
+
+ // ----- Get the only interesting attributes
+ if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Look for user callback abort
+ if ($v_result1 == 2) {
+ break;
+ }
+ }
+ }
+ }
+
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFile()
+ // Description :
+ // Parameters :
+ // Return Values :
+ //
+ // 1 : ... ?
+ // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
+ // --------------------------------------------------------------------------------
+ function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
+ $v_result=1;
+
+ // ----- Read the file header
+ if (($v_result = $this->privReadFileHeader($v_header)) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
+
+ // ----- Check that the file header is coherent with $p_entry info
+ if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+ // TBC
+ }
+
+ // ----- Look for all path to remove
+ if ($p_remove_all_path == true) {
+ // ----- Look for folder entry that not need to be extracted
+ if (($p_entry['external']&0x00000010)==0x00000010) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");
+
+ $p_entry['status'] = "filtered";
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
+ // ----- Get the basename of the path
+ $p_entry['filename'] = basename($p_entry['filename']);
+ }
+
+ // ----- Look for path to remove
+ else if ($p_remove_path != "")
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
+ if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");
+
+ // ----- Change the file status
+ $p_entry['status'] = "filtered";
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ $p_remove_path_size = strlen($p_remove_path);
+ if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
+
+ // ----- Remove the path
+ $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
+ }
+ }
+
+ // ----- Add the path
+ if ($p_path != '') {
+ $p_entry['filename'] = $p_path."/".$p_entry['filename'];
+ }
+
+ // ----- Check a base_dir_restriction
+ if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
+ $v_inclusion
+ = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
+ $p_entry['filename']);
+ if ($v_inclusion == 0) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
+
+ PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
+ "Filename '".$p_entry['filename']."' is "
+ ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Look for pre-extract callback
+ if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
+ // ----- This status is internal and will be changed in 'skipped'
+ $p_entry['status'] = "aborted";
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ $p_entry['filename'] = $v_local_header['filename'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+
+ // ----- Look for specific actions while the file exist
+ if (file_exists($p_entry['filename']))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");
+
+ // ----- Look if file is a directory
+ if (is_dir($p_entry['filename']))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");
+
+ // ----- Change the file status
+ $p_entry['status'] = "already_a_directory";
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ // For historical reason first PclZip implementation does not stop
+ // when this kind of error occurs.
+ if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
+
+ PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
+ "Filename '".$p_entry['filename']."' is "
+ ."already used by an existing directory");
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+ // ----- Look if file is write protected
+ else if (!is_writeable($p_entry['filename']))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");
+
+ // ----- Change the file status
+ $p_entry['status'] = "write_protected";
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ // For historical reason first PclZip implementation does not stop
+ // when this kind of error occurs.
+ if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
+
+ PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
+ "Filename '".$p_entry['filename']."' exists "
+ ."and is write protected");
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Look if the extracted file is older
+ else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
+ // ----- Change the file status
+ if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
+ && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
+ $p_entry['status'] = "newer_exist";
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ // For historical reason first PclZip implementation does not stop
+ // when this kind of error occurs.
+ if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
+
+ PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
+ "Newer version of '".$p_entry['filename']."' exists "
+ ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
+ }
+ }
+
+ // ----- Check the directory availability and create it if necessary
+ else {
+ if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
+ $v_dir_to_check = $p_entry['filename'];
+ else if (!strstr($p_entry['filename'], "/"))
+ $v_dir_to_check = "";
+ else
+ $v_dir_to_check = dirname($p_entry['filename']);
+
+ if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
+
+ // ----- Change the file status
+ $p_entry['status'] = "path_creation_fail";
+
+ // ----- Return
+ ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ //return $v_result;
+ $v_result = 1;
+ }
+ }
+ }
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010)==0x00000010))
+ {
+ // ----- Look for not compressed file
+ if ($p_entry['compression'] == 0) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
+
+ // ----- Opening destination file
+ if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
+
+ // ----- Change the file status
+ $p_entry['status'] = "write_error";
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");
+
+ // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+ $v_size = $p_entry['compressed_size'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
+ $v_buffer = @fread($this->zip_fd, $v_read_size);
+ /* Try to speed up the code
+ $v_binary_data = pack('a'.$v_read_size, $v_buffer);
+ @fwrite($v_dest_file, $v_binary_data, $v_read_size);
+ */
+ @fwrite($v_dest_file, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Closing the destination file
+ fclose($v_dest_file);
+
+ // ----- Change the file mtime
+ touch($p_entry['filename'], $p_entry['mtime']);
+
+
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
+ // ----- TBC
+ // Need to be finished
+ if (($p_entry['flag'] & 1) == 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
+ /*
+ // ----- Read the encryption header
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
+ $v_encryption_header = @fread($this->zip_fd, 12);
+
+ // ----- Read the encrypted & compressed file in a buffer
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);
+
+ // ----- Decrypt the buffer
+ $this->privDecrypt($v_encryption_header, $v_buffer,
+ $p_entry['compressed_size']-12, $p_entry['crc']);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");
+ */
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
+ // ----- Read the compressed file in a buffer (one shot)
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+
+ // ----- Decompress the file
+ $v_file_content = @gzinflate($v_buffer);
+ unset($v_buffer);
+ if ($v_file_content === FALSE) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
+
+ // ----- Change the file status
+ // TBC
+ $p_entry['status'] = "error";
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Opening destination file
+ if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
+
+ // ----- Change the file status
+ $p_entry['status'] = "write_error";
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Write the uncompressed data
+ @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
+ unset($v_file_content);
+
+ // ----- Closing the destination file
+ @fclose($v_dest_file);
+
+ // ----- Change the file mtime
+ @touch($p_entry['filename'], $p_entry['mtime']);
+ }
+
+ // ----- Look for chmod option
+ if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
+
+ // ----- Change the mode of the file
+ @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
+ }
+ }
+
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ }
+
+ // ----- Look for post-extract callback
+ elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFileInOutput()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privExtractFileInOutput(&$p_entry, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
+ $v_result=1;
+
+ // ----- Read the file header
+ if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
+
+ // ----- Check that the file header is coherent with $p_entry info
+ if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+ // TBC
+ }
+
+ // ----- Look for pre-extract callback
+ if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
+ // ----- This status is internal and will be changed in 'skipped'
+ $p_entry['status'] = "aborted";
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ $p_entry['filename'] = $v_local_header['filename'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
+ }
+
+ // ----- Trace
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+ // ----- Look for not compressed file
+ if ($p_entry['compressed_size'] == $p_entry['size']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
+
+ // ----- Read the file in a buffer (one shot)
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Send the file to the output
+ echo $v_buffer;
+ unset($v_buffer);
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");
+
+ // ----- Read the compressed file in a buffer (one shot)
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Decompress the file
+ $v_file_content = gzinflate($v_buffer);
+ unset($v_buffer);
+
+ // ----- Send the file to the output
+ echo $v_file_content;
+ unset($v_file_content);
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
+ }
+ }
+
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ }
+
+ // ----- Look for post-extract callback
+ elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFileAsString()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privExtractFileAsString(&$p_entry, &$p_string)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
+ $v_result=1;
+
+ // ----- Read the file header
+ $v_header = array();
+ if (($v_result = $this->privReadFileHeader($v_header)) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
+
+ // ----- Check that the file header is coherent with $p_entry info
+ if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+ // TBC
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");
+
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010)==0x00000010))
+ {
+ // ----- Look for not compressed file
+// if ($p_entry['compressed_size'] == $p_entry['size'])
+ if ($p_entry['compression'] == 0) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
+
+ // ----- Reading the file
+ $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");
+
+ // ----- Reading the file
+ $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Decompress the file
+ if (($p_string = @gzinflate($v_data)) === FALSE) {
+ // TBC
+ }
+ }
+
+ // ----- Trace
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
+ }
+ else {
+ // TBC : error : can not extract a folder in a string
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privReadFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privReadFileHeader(&$p_header)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
+ $v_result=1;
+
+ // ----- Read the 4 bytes signature
+ $v_binary_data = @fread($this->zip_fd, 4);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
+ $v_data = unpack('Vid', $v_binary_data);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
+
+ // ----- Check signature
+ if ($v_data['id'] != 0x04034b50)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the first 42 bytes of the header
+ $v_binary_data = fread($this->zip_fd, 26);
+
+ // ----- Look for invalid block size
+ if (strlen($v_binary_data) != 26)
+ {
+ $p_header['filename'] = "";
+ $p_header['status'] = "invalid_header";
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the values
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
+ $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
+
+ // ----- Get filename
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
+ $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');
+
+ // ----- Get extra_fields
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
+ if ($v_data['extra_len'] != 0) {
+ $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
+ }
+ else {
+ $p_header['extra'] = '';
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');
+
+ // ----- Extract properties
+ $p_header['version_extracted'] = $v_data['version'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
+ $p_header['compression'] = $v_data['compression'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
+ $p_header['size'] = $v_data['size'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
+ $p_header['compressed_size'] = $v_data['compressed_size'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
+ $p_header['crc'] = $v_data['crc'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
+ $p_header['flag'] = $v_data['flag'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
+ $p_header['filename_len'] = $v_data['filename_len'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
+
+ // ----- Recuperate date in UNIX format
+ $p_header['mdate'] = $v_data['mdate'];
+ $p_header['mtime'] = $v_data['mtime'];
+ if ($p_header['mdate'] && $p_header['mtime'])
+ {
+ // ----- Extract time
+ $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+ $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+ $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+ // ----- Extract date
+ $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+ $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+ $v_day = $p_header['mdate'] & 0x001F;
+
+ // ----- Get UNIX date format
+ $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+ }
+ else
+ {
+ $p_header['mtime'] = time();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+ }
+
+ // TBC
+ //for(reset($v_data); $key = key($v_data); next($v_data)) {
+ // //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
+ //}
+
+ // ----- Set the stored filename
+ $p_header['stored_filename'] = $p_header['filename'];
+
+ // ----- Set the status field
+ $p_header['status'] = "ok";
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privReadCentralFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privReadCentralFileHeader(&$p_header)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
+ $v_result=1;
+
+ // ----- Read the 4 bytes signature
+ $v_binary_data = @fread($this->zip_fd, 4);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
+ $v_data = unpack('Vid', $v_binary_data);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
+
+ // ----- Check signature
+ if ($v_data['id'] != 0x02014b50)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the first 42 bytes of the header
+ $v_binary_data = fread($this->zip_fd, 42);
+
+ // ----- Look for invalid block size
+ if (strlen($v_binary_data) != 42)
+ {
+ $p_header['filename'] = "";
+ $p_header['status'] = "invalid_header";
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the values
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
+ $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
+
+ // ----- Get filename
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
+ if ($p_header['filename_len'] != 0)
+ $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
+ else
+ $p_header['filename'] = '';
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');
+
+ // ----- Get extra
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
+ if ($p_header['extra_len'] != 0)
+ $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
+ else
+ $p_header['extra'] = '';
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');
+
+ // ----- Get comment
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
+ if ($p_header['comment_len'] != 0)
+ $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
+ else
+ $p_header['comment'] = '';
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');
+
+ // ----- Extract properties
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
+
+ // ----- Recuperate date in UNIX format
+ if ($p_header['mdate'] && $p_header['mtime'])
+ {
+ // ----- Extract time
+ $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+ $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+ $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+ // ----- Extract date
+ $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+ $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+ $v_day = $p_header['mdate'] & 0x001F;
+
+ // ----- Get UNIX date format
+ $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+ }
+ else
+ {
+ $p_header['mtime'] = time();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+ }
+
+ // ----- Set the stored filename
+ $p_header['stored_filename'] = $p_header['filename'];
+
+ // ----- Set default status to ok
+ $p_header['status'] = 'ok';
+
+ // ----- Look if it is a directory
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
+ if (substr($p_header['filename'], -1) == '/') {
+ //$p_header['external'] = 0x41FF0010;
+ $p_header['external'] = 0x00000010;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCheckFileHeaders()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // 1 on success,
+ // 0 on error;
+ // --------------------------------------------------------------------------------
+ function privCheckFileHeaders(&$p_local_header, &$p_central_header)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
+ $v_result=1;
+
+ // ----- Check the static values
+ // TBC
+ if ($p_local_header['filename'] != $p_central_header['filename']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
+ }
+ if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
+ }
+ if ($p_local_header['flag'] != $p_central_header['flag']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
+ }
+ if ($p_local_header['compression'] != $p_central_header['compression']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
+ }
+ if ($p_local_header['mtime'] != $p_central_header['mtime']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
+ }
+ if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
+ }
+
+ // ----- Look for flag bit 3
+ if (($p_local_header['flag'] & 8) == 8) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
+ $p_local_header['size'] = $p_central_header['size'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
+ $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
+ $p_local_header['crc'] = $p_central_header['crc'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privReadEndCentralDir()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privReadEndCentralDir(&$p_central_dir)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
+ $v_result=1;
+
+ // ----- Go to the end of the zip file
+ $v_size = filesize($this->zipname);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
+ @fseek($this->zip_fd, $v_size);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
+ if (@ftell($this->zip_fd) != $v_size)
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- First try : look if this is an archive with no commentaries (most of the time)
+ // in this case the end of central dir is at 22 bytes of the file end
+ $v_found = 0;
+ if ($v_size > 26) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
+ @fseek($this->zip_fd, $v_size-22);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
+ if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Read for bytes
+ $v_binary_data = @fread($this->zip_fd, 4);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
+ $v_data = @unpack('Vid', $v_binary_data);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
+
+ // ----- Check signature
+ if ($v_data['id'] == 0x06054b50) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
+ $v_found = 1;
+ }
+
+ $v_pos = ftell($this->zip_fd);
+ }
+
+ // ----- Go back to the maximum possible size of the Central Dir End Record
+ if (!$v_found) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
+ $v_maximum_size = 65557; // 0xFFFF + 22;
+ if ($v_maximum_size > $v_size)
+ $v_maximum_size = $v_size;
+ @fseek($this->zip_fd, $v_size-$v_maximum_size);
+ if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');
+
+ // ----- Read byte per byte in order to find the signature
+ $v_pos = ftell($this->zip_fd);
+ $v_bytes = 0x00000000;
+ while ($v_pos < $v_size)
+ {
+ // ----- Read a byte
+ $v_byte = @fread($this->zip_fd, 1);
+
+ // ----- Add the byte
+ $v_bytes = ($v_bytes << 8) | Ord($v_byte);
+
+ // ----- Compare the bytes
+ if ($v_bytes == 0x504b0506)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
+ $v_pos++;
+ break;
+ }
+
+ $v_pos++;
+ }
+
+ // ----- Look if not found end of central dir
+ if ($v_pos == $v_size)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Read the first 18 bytes of the header
+ $v_binary_data = fread($this->zip_fd, 18);
+
+ // ----- Look for invalid block size
+ if (strlen($v_binary_data) != 18)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the values
+ ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
+ ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
+ $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
+
+ // ----- Check the global size
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
+ if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");
+
+ // ----- Removed in release 2.2 see readme file
+ // The check of the file size is a little too strict.
+ // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
+ // While decrypted, zip has training 0 bytes
+ if (0) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
+ 'The central dir is not at the end of the archive.'
+ .' Some trailing bytes exists after the archive.');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Get comment
+ if ($v_data['comment_size'] != 0)
+ $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
+ else
+ $p_central_dir['comment'] = '';
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
+
+ $p_central_dir['entries'] = $v_data['entries'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
+ $p_central_dir['disk_entries'] = $v_data['disk_entries'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
+ $p_central_dir['offset'] = $v_data['offset'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
+ $p_central_dir['size'] = $v_data['size'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
+ $p_central_dir['disk'] = $v_data['disk'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
+ $p_central_dir['disk_start'] = $v_data['disk_start'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');
+
+ // TBC
+ //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
+ // //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
+ //}
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDeleteByRule()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privDeleteByRule(&$p_result_list, &$p_options)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
+ $v_result=1;
+ $v_list_detail = array();
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_result=$this->privOpenFd('rb')) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+ {
+ $this->privCloseFd();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
+
+ // ----- Scan all the files
+ // ----- Start at beginning of Central Dir
+ $v_pos_entry = $v_central_dir['offset'];
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
+ if (@fseek($this->zip_fd, $v_pos_entry))
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
+
+ // ----- Read each entry
+ $v_header_list = array();
+ $j_start = 0;
+ for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");
+
+ // ----- Read the file header
+ $v_header_list[$v_nb_extracted] = array();
+ if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
+ {
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");
+
+ // ----- Store the index
+ $v_header_list[$v_nb_extracted]['index'] = $i;
+
+ // ----- Look for the specific extract rules
+ $v_found = false;
+
+ // ----- Look for extract by name rule
+ if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
+ && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
+
+ // ----- Look if the filename is in the list
+ for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
+
+ // ----- Look for a directory
+ if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
+
+ // ----- Look if the directory is in the filename path
+ if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
+ && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
+ $v_found = true;
+ }
+ elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
+ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
+ $v_found = true;
+ }
+ }
+ // ----- Look for a filename
+ elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
+ $v_found = true;
+ }
+ }
+ }
+
+ // ----- Look for extract by ereg rule
+ else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
+ && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
+
+ if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
+ $v_found = true;
+ }
+ }
+
+ // ----- Look for extract by preg rule
+ else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
+ && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
+
+ if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
+ $v_found = true;
+ }
+ }
+
+ // ----- Look for extract by index rule
+ else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
+ && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
+
+ // ----- Look if the index is in the list
+ for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
+
+ if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
+ $v_found = true;
+ }
+ if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
+ $j_start = $j+1;
+ }
+
+ if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
+ break;
+ }
+ }
+ }
+ else {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
+ $v_found = true;
+ }
+
+ // ----- Look for deletion
+ if ($v_found)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
+ unset($v_header_list[$v_nb_extracted]);
+ }
+ else
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
+ $v_nb_extracted++;
+ }
+ }
+
+ // ----- Look if something need to be deleted
+ if ($v_nb_extracted > 0) {
+
+ // ----- Creates a temporay file
+ $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+ // ----- Creates a temporary zip archive
+ $v_temp_zip = new PclZip($v_zip_temp_name);
+
+ // ----- Open the temporary zip file in write mode
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
+ if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
+ $this->privCloseFd();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Look which file need to be kept
+ for ($i=0; $i<sizeof($v_header_list); $i++) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
+
+ // ----- Calculate the position of the header
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
+ if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
+
+ // ----- Read the file header
+ $v_local_header = array();
+ if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Check that local file header is same as central file header
+ if ($this->privCheckFileHeaders($v_local_header,
+ $v_header_list[$i]) != 1) {
+ // TBC
+ }
+ unset($v_local_header);
+
+ // ----- Write the file header
+ if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
+
+ // ----- Read/write the data block
+ if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($v_temp_zip->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
+
+ // ----- Re-Create the Central Dir files header
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
+ for ($i=0; $i<sizeof($v_header_list); $i++) {
+ // ----- Create the file header
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
+ if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+ $v_temp_zip->privCloseFd();
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Transform the header to a 'usable' info
+ $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+ }
+
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
+
+ // ----- Zip file comment
+ $v_comment = '';
+ if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+ }
+
+ // ----- Calculate the size of the central header
+ $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
+
+ // ----- Create the central dir footer
+ if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
+ // ----- Reset the file list
+ unset($v_header_list);
+ $v_temp_zip->privCloseFd();
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Close
+ $v_temp_zip->privCloseFd();
+ $this->privCloseFd();
+
+ // ----- Delete the zip file
+ // TBC : I should test the result ...
+ @unlink($this->zipname);
+
+ // ----- Rename the temporary file
+ // TBC : I should test the result ...
+ //@rename($v_zip_temp_name, $this->zipname);
+ PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+ // ----- Destroy the temporary archive
+ unset($v_temp_zip);
+ }
+
+ // ----- Remove every files : reset the file
+ else if ($v_central_dir['entries'] != 0) {
+ $this->privCloseFd();
+
+ if (($v_result = $this->privOpenFd('wb')) != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ $this->privCloseFd();
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDirCheck()
+ // Description :
+ // Check if a directory exists, if not it creates it and all the parents directory
+ // which may be useful.
+ // Parameters :
+ // $p_dir : Directory path to check.
+ // Return Values :
+ // 1 : OK
+ // -1 : Unable to create directory
+ // --------------------------------------------------------------------------------
+ function privDirCheck($p_dir, $p_is_dir=false)
+ {
+ $v_result = 1;
+
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
+
+ // ----- Remove the final '/'
+ if (($p_is_dir) && (substr($p_dir, -1)=='/'))
+ {
+ $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
+
+ // ----- Check the directory availability
+ if ((is_dir($p_dir)) || ($p_dir == ""))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
+ return 1;
+ }
+
+ // ----- Extract parent directory
+ $p_parent_dir = dirname($p_dir);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
+
+ // ----- Just a check
+ if ($p_parent_dir != $p_dir)
+ {
+ // ----- Look for parent directory
+ if ($p_parent_dir != "")
+ {
+ if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ }
+ }
+
+ // ----- Create the directory
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
+ if (!@mkdir($p_dir, 0777))
+ {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privMerge()
+ // Description :
+ // If $p_archive_to_add does not exist, the function exit with a success result.
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privMerge(&$p_archive_to_add)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
+ $v_result=1;
+
+ // ----- Look if the archive_to_add exists
+ if (!is_file($p_archive_to_add->zipname))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");
+
+ // ----- Nothing to merge, so merge is a success
+ $v_result = 1;
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Look if the archive exists
+ if (!is_file($this->zipname))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");
+
+ // ----- Do a duplicate
+ $v_result = $this->privDuplicate($p_archive_to_add->zipname);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_result=$this->privOpenFd('rb')) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+ {
+ $this->privCloseFd();
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
+ @rewind($this->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
+
+ // ----- Open the archive_to_add file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
+ if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
+ {
+ $this->privCloseFd();
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir_to_add = array();
+ if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
+ {
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
+ @rewind($p_archive_to_add->zip_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
+
+ // ----- Creates a temporay file
+ $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+ // ----- Open the temporary file in write mode
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
+ {
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Copy the files from the archive to the temporary file
+ // TBC : Here I should better append the file and go back to erase the central dir
+ $v_size = $v_central_dir['offset'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = fread($this->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Copy the files from the archive_to_add into the temporary file
+ $v_size = $v_central_dir_to_add['offset'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($v_zip_temp_fd);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
+
+ // ----- Copy the block of file headers from the old archive
+ $v_size = $v_central_dir['size'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @fread($this->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Copy the block of file headers from the archive_to_add
+ $v_size = $v_central_dir_to_add['size'];
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Merge the file comments
+ $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
+
+ // ----- Calculate the size of the (new) central header
+ $v_size = @ftell($v_zip_temp_fd)-$v_offset;
+
+ // ----- Swap the file descriptor
+ // Here is a trick : I swap the temporary fd with the zip fd, in order to use
+ // the following methods on the temporary fil and not the real archive fd
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Create the central dir footer
+ if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
+ {
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+ @fclose($v_zip_temp_fd);
+ $this->zip_fd = null;
+
+ // ----- Reset the file list
+ unset($v_header_list);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Swap back the file descriptor
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Close
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+
+ // ----- Close the temporary file
+ @fclose($v_zip_temp_fd);
+
+ // ----- Delete the zip file
+ // TBC : I should test the result ...
+ @unlink($this->zipname);
+
+ // ----- Rename the temporary file
+ // TBC : I should test the result ...
+ //@rename($v_zip_temp_name, $this->zipname);
+ PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDuplicate()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privDuplicate($p_archive_filename)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
+ $v_result=1;
+
+ // ----- Look if the $p_archive_filename exists
+ if (!is_file($p_archive_filename))
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");
+
+ // ----- Nothing to duplicate, so duplicate is a success.
+ $v_result = 1;
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Open the zip file
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_result=$this->privOpenFd('wb')) != 1)
+ {
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Open the temporary file in write mode
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
+ if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
+ {
+ $this->privCloseFd();
+
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+ return PclZip::errorCode();
+ }
+
+ // ----- Copy the files from the archive to the temporary file
+ // TBC : Here I should better append the file and go back to erase the central dir
+ $v_size = filesize($p_archive_filename);
+ while ($v_size != 0)
+ {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
+ $v_buffer = fread($v_zip_temp_fd, $v_read_size);
+ @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Close
+ $this->privCloseFd();
+
+ // ----- Close the temporary file
+ @fclose($v_zip_temp_fd);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privErrorLog()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function privErrorLog($p_error_code=0, $p_error_string='')
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ PclError($p_error_code, $p_error_string);
+ }
+ else {
+ $this->error_code = $p_error_code;
+ $this->error_string = $p_error_string;
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privErrorReset()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ function privErrorReset()
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ PclErrorReset();
+ }
+ else {
+ $this->error_code = 0;
+ $this->error_string = '';
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDecrypt()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
+ $v_result=1;
+
+ // ----- To Be Modified ;-)
+ $v_pwd = "test";
+
+ $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
+ $p_crc, $v_pwd);
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDisableMagicQuotes()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privDisableMagicQuotes()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");
+ $v_result=1;
+
+ // ----- Look if function exists
+ if ( (!function_exists("get_magic_quotes_runtime"))
+ || (!function_exists("set_magic_quotes_runtime"))) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Look if already done
+ if ($this->magic_quotes_status != -1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Get and memorize the magic_quote value
+ $this->magic_quotes_status = @get_magic_quotes_runtime();
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");
+
+ // ----- Disable magic_quotes
+ if ($this->magic_quotes_status == 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
+ @set_magic_quotes_runtime(0);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privSwapBackMagicQuotes()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function privSwapBackMagicQuotes()
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");
+ $v_result=1;
+
+ // ----- Look if function exists
+ if ( (!function_exists("get_magic_quotes_runtime"))
+ || (!function_exists("set_magic_quotes_runtime"))) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Look if something to do
+ if ($this->magic_quotes_status != -1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+
+ // ----- Swap back magic_quotes
+ if ($this->magic_quotes_status == 1) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
+ @set_magic_quotes_runtime($this->magic_quotes_status);
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ }
+ // End of class
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZipUtilPathReduction()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function PclZipUtilPathReduction($p_dir)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
+ $v_result = "";
+
+ // ----- Look for not empty path
+ if ($p_dir != "") {
+ // ----- Explode path by directory names
+ $v_list = explode("/", $p_dir);
+
+ // ----- Study directories from last to first
+ $v_skip = 0;
+ for ($i=sizeof($v_list)-1; $i>=0; $i--) {
+ // ----- Look for current path
+ if ($v_list[$i] == ".") {
+ // ----- Ignore this directory
+ // Should be the first $i=0, but no check is done
+ }
+ else if ($v_list[$i] == "..") {
+ $v_skip++;
+ }
+ else if ($v_list[$i] == "") {
+ // ----- First '/' i.e. root slash
+ if ($i == 0) {
+ $v_result = "/".$v_result;
+ if ($v_skip > 0) {
+ // ----- It is an invalid path, so the path is not modified
+ // TBC
+ $v_result = $p_dir;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
+ $v_skip = 0;
+ }
+ }
+ // ----- Last '/' i.e. indicates a directory
+ else if ($i == (sizeof($v_list)-1)) {
+ $v_result = $v_list[$i];
+ }
+ // ----- Double '/' inside the path
+ else {
+ // ----- Ignore only the double '//' in path,
+ // but not the first and last '/'
+ }
+ }
+ else {
+ // ----- Look for item to skip
+ if ($v_skip > 0) {
+ $v_skip--;
+ }
+ else {
+ $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
+ }
+ }
+ }
+
+ // ----- Look for skip
+ if ($v_skip > 0) {
+ while ($v_skip > 0) {
+ $v_result = '../'.$v_result;
+ $v_skip--;
+ }
+ }
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZipUtilPathInclusion()
+ // Description :
+ // This function indicates if the path $p_path is under the $p_dir tree. Or,
+ // said in an other way, if the file or sub-dir $p_path is inside the dir
+ // $p_dir.
+ // The function indicates also if the path is exactly the same as the dir.
+ // This function supports path with duplicated '/' like '//', but does not
+ // support '.' or '..' statements.
+ // Parameters :
+ // Return Values :
+ // 0 if $p_path is not inside directory $p_dir
+ // 1 if $p_path is inside directory $p_dir
+ // 2 if $p_path is exactly the same as $p_dir
+ // --------------------------------------------------------------------------------
+ function PclZipUtilPathInclusion($p_dir, $p_path)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
+ $v_result = 1;
+
+ // ----- Look for path beginning by ./
+ if ( ($p_dir == '.')
+ || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
+ $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
+ }
+ if ( ($p_path == '.')
+ || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
+ $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");
+ }
+
+ // ----- Explode dir and path by directory separator
+ $v_list_dir = explode("/", $p_dir);
+ $v_list_dir_size = sizeof($v_list_dir);
+ $v_list_path = explode("/", $p_path);
+ $v_list_path_size = sizeof($v_list_path);
+
+ // ----- Study directories paths
+ $i = 0;
+ $j = 0;
+ while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
+
+ // ----- Look for empty dir (path reduction)
+ if ($v_list_dir[$i] == '') {
+ $i++;
+ continue;
+ }
+ if ($v_list_path[$j] == '') {
+ $j++;
+ continue;
+ }
+
+ // ----- Compare the items
+ if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
+ $v_result = 0;
+ }
+
+ // ----- Next items
+ $i++;
+ $j++;
+ }
+
+ // ----- Look if everything seems to be the same
+ if ($v_result) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
+ // ----- Skip all the empty items
+ while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
+ while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");
+
+ if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
+ // ----- There are exactly the same
+ $v_result = 2;
+ }
+ else if ($i < $v_list_dir_size) {
+ // ----- The path is shorter than the dir
+ $v_result = 0;
+ }
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZipUtilCopyBlock()
+ // Description :
+ // Parameters :
+ // $p_mode : read/write compression mode
+ // 0 : src & dest normal
+ // 1 : src gzip, dest normal
+ // 2 : src normal, dest gzip
+ // 3 : src & dest gzip
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
+ $v_result = 1;
+
+ if ($p_mode==0)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
+ while ($p_size != 0)
+ {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @fread($p_src, $v_read_size);
+ @fwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
+ }
+ else if ($p_mode==1)
+ {
+ while ($p_size != 0)
+ {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @gzread($p_src, $v_read_size);
+ @fwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ }
+ else if ($p_mode==2)
+ {
+ while ($p_size != 0)
+ {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @fread($p_src, $v_read_size);
+ @gzwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ }
+ else if ($p_mode==3)
+ {
+ while ($p_size != 0)
+ {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
+ $v_buffer = @gzread($p_src, $v_read_size);
+ @gzwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZipUtilRename()
+ // Description :
+ // This function tries to do a simple rename() function. If it fails, it
+ // tries to copy the $p_src file in a new $p_dest file and then unlink the
+ // first one.
+ // Parameters :
+ // $p_src : Old filename
+ // $p_dest : New filename
+ // Return Values :
+ // 1 on success, 0 on failure.
+ // --------------------------------------------------------------------------------
+ function PclZipUtilRename($p_src, $p_dest)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
+ $v_result = 1;
+
+ // ----- Try to rename the files
+ if (!@rename($p_src, $p_dest)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");
+
+ // ----- Try to copy & unlink the src
+ if (!@copy($p_src, $p_dest)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
+ $v_result = 0;
+ }
+ else if (!@unlink($p_src)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
+ $v_result = 0;
+ }
+ }
+
+ // ----- Return
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZipUtilOptionText()
+ // Description :
+ // Translate option value in text. Mainly for debug purpose.
+ // Parameters :
+ // $p_option : the option value.
+ // Return Values :
+ // The option text value.
+ // --------------------------------------------------------------------------------
+ function PclZipUtilOptionText($p_option)
+ {
+ //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
+
+ $v_list = get_defined_constants();
+ for (reset($v_list); $v_key = key($v_list); next($v_list)) {
+ $v_prefix = substr($v_key, 0, 10);
+ if (( ($v_prefix == 'PCLZIP_OPT')
+ || ($v_prefix == 'PCLZIP_CB_')
+ || ($v_prefix == 'PCLZIP_ATT'))
+ && ($v_list[$v_key] == $p_option)) {
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
+ return $v_key;
+ }
+ }
+
+ $v_result = 'Unknown';
+
+ //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : PclZipUtilTranslateWinPath()
+ // Description :
+ // Translate windows path by replacing '\' by '/' and optionally removing
+ // drive letter.
+ // Parameters :
+ // $p_path : path to translate.
+ // $p_remove_disk_letter : true | false
+ // Return Values :
+ // The path translated.
+ // --------------------------------------------------------------------------------
+ function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
+ {
+ if (stristr(php_uname(), 'windows')) {
+ // ----- Look for potential disk letter
+ if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
+ $p_path = substr($p_path, $v_position+1);
+ }
+ // ----- Change potential windows directory separator
+ if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
+ $p_path = strtr($p_path, '\\', '/');
+ }
+ }
+ return $p_path;
+ }
+ // --------------------------------------------------------------------------------
+
+
+?>
diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php
new file mode 100644
index 0000000..d698b20
--- /dev/null
+++ b/wp-admin/includes/class-wp-filesystem-direct.php
@@ -0,0 +1,336 @@
+<?php
+
+class WP_Filesystem_Direct{
+ var $permission = null;
+ var $errors = array();
+ function WP_Filesystem_Direct($arg){
+ $this->errors = new WP_Error();
+ $this->permission = umask();
+ }
+ function connect(){
+ return;
+ }
+ function setDefaultPermissions($perm){
+ $this->permission = $perm;
+ }
+ function find_base_dir($base = '.', $echo = false){
+ return str_replace('\\','/',ABSPATH);
+ }
+ function get_base_dir($base = '.', $echo = false){
+ return find_base_dir($base, $echo);
+ }
+ function get_contents($file){
+ return @file_get_contents($file);
+ }
+ function get_contents_array($file){
+ return @file($file);
+ }
+ function put_contents($file,$contents,$mode=false,$type=''){
+ $fp=@fopen($file,'w'.$type);
+ if (!$fp)
+ return false;
+ @fwrite($fp,$contents);
+ @fclose($fp);
+ $this->chmod($file,$mode);
+ return true;
+ }
+ function cwd(){
+ return @getcwd();
+ }
+ function chgrp($file,$group,$recursive=false){
+ if( ! $this->exists($file) )
+ return false;
+ if( ! $recursive )
+ return @chgrp($file,$group);
+ if( ! $this->is_dir($file) )
+ return @chgrp($file,$group);
+ //Is a directory, and we want recursive
+ $filelist = $this->dirlist($file);
+ foreach($filelist as $filename){
+ $this->chgrp($file.'/'.$filename,$group,$recursive);
+ }
+ return true;
+ }
+ function chmod($file,$mode=false,$recursive=false){
+ if( ! $mode )
+ $mode = $this->permission;
+ if( ! $this->exists($file) )
+ return false;
+ if( ! $recursive )
+ return @chmod($file,$mode);
+ if( ! $this->is_dir($file) )
+ return @chmod($file,$mode);
+ //Is a directory, and we want recursive
+ $filelist = $this->dirlist($file);
+ foreach($filelist as $filename){
+ $this->chmod($file.'/'.$filename,$mode,$recursive);
+ }
+ return true;
+ }
+ function chown($file,$owner,$recursive=false){
+ if( ! $this->exists($file) )
+ return false;
+ if( ! $recursive )
+ return @chown($file,$owner);
+ if( ! $this->is_dir($file) )
+ return @chown($file,$owner);
+ //Is a directory, and we want recursive
+ $filelist = $this->dirlist($file);
+ foreach($filelist as $filename){
+ $this->chown($file.'/'.$filename,$owner,$recursive);
+ }
+ return true;
+ }
+ function owner($file){
+ $owneruid=@fileowner($file);
+ if( ! $owneruid )
+ return false;
+ if( !function_exists('posix_getpwuid') )
+ return $owneruid;
+ $ownerarray=posix_getpwuid($owneruid);
+ return $ownerarray['name'];
+ }
+ function getchmod($file){
+ return @fileperms($file);
+ }
+ function gethchmod($file){
+ //From the PHP.net page for ...?
+ $perms = $this->getchmod($file);
+ if (($perms & 0xC000) == 0xC000) {
+ // Socket
+ $info = 's';
+ } elseif (($perms & 0xA000) == 0xA000) {
+ // Symbolic Link
+ $info = 'l';
+ } elseif (($perms & 0x8000) == 0x8000) {
+ // Regular
+ $info = '-';
+ } elseif (($perms & 0x6000) == 0x6000) {
+ // Block special
+ $info = 'b';
+ } elseif (($perms & 0x4000) == 0x4000) {
+ // Directory
+ $info = 'd';
+ } elseif (($perms & 0x2000) == 0x2000) {
+ // Character special
+ $info = 'c';
+ } elseif (($perms & 0x1000) == 0x1000) {
+ // FIFO pipe
+ $info = 'p';
+ } else {
+ // Unknown
+ $info = 'u';
+ }
+
+ // Owner
+ $info .= (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ?
+ (($perms & 0x0800) ? 's' : 'x' ) :
+ (($perms & 0x0800) ? 'S' : '-'));
+
+ // Group
+ $info .= (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ?
+ (($perms & 0x0400) ? 's' : 'x' ) :
+ (($perms & 0x0400) ? 'S' : '-'));
+
+ // World
+ $info .= (($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ?
+ (($perms & 0x0200) ? 't' : 'x' ) :
+ (($perms & 0x0200) ? 'T' : '-'));
+ return $info;
+ }
+ function getnumchmodfromh($mode) {
+ $realmode = "";
+ $legal = array("","w","r","x","-");
+ $attarray = preg_split("//",$mode);
+ for($i=0;$i<count($attarray);$i++){
+ if($key = array_search($attarray[$i],$legal)){
+ $realmode .= $legal[$key];
+ }
+ }
+ $mode = str_pad($realmode,9,'-');
+ $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
+ $mode = strtr($mode,$trans);
+ $newmode = '';
+ $newmode .= $mode[0]+$mode[1]+$mode[2];
+ $newmode .= $mode[3]+$mode[4]+$mode[5];
+ $newmode .= $mode[6]+$mode[7]+$mode[8];
+ return $newmode;
+ }
+ function group($file){
+ $gid=@filegroup($file);
+ if( ! $gid )
+ return false;
+ if( !function_exists('posix_getgrgid') )
+ return $gid;
+ $grouparray=posix_getgrgid($gid);
+ return $grouparray['name'];
+ }
+
+ function copy($source,$destination,$overwrite=false){
+ if( $overwrite && $this->exists($destination) )
+ return false;
+ return copy($source,$destination);
+ }
+
+ function move($source,$destination,$overwrite=false){
+ //Possible to use rename()
+ if( $this->copy($source,$destination,$overwrite) && $this->exists($destination) ){
+ $this->delete($source);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function delete($file,$recursive=false){
+ $file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise
+
+ if( $this->is_file($file) )
+ return @unlink($file);
+
+ if( !$recursive && $this->is_dir($file) )
+ return @rmdir($file);
+
+ $filelist = $this->dirlist($file);
+ if( ! $filelist )
+ return true; //No files exist, Say we've deleted them
+
+ $retval = true;
+ foreach($filelist as $filename=>$fileinfo){
+ if( ! $this->delete($file.'/'.$filename,$recursive) )
+ $retval = false;
+ }
+ if( ! @rmdir($file) )
+ return false;
+ return $retval;
+ }
+
+ function exists($file){
+ return @file_exists($file);
+ }
+
+ function is_file($file){
+ return @is_file($file);
+ }
+
+ function is_dir($path){
+ return @is_dir($path);
+ }
+
+ function is_readable($file){
+ return @is_readable($file);
+ }
+
+ function is_writable($file){
+ return @is_writable($file);
+ }
+
+ function atime($file){
+ return @fileatime($file);
+ }
+
+ function mtime($file){
+ return @filemtime($file);
+ }
+ function size($file){
+ return @filesize($file);
+ }
+
+ function touch($file,$time=0,$atime=0){
+ if($time==0)
+ $time = time();
+ if($atime==0)
+ $atime = time();
+ return @touch($file,$time,$atime);
+ }
+
+ function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ if( ! $chmod)
+ $chmod = $this->permission;
+
+ if( !@mkdir($path,$chmod) )
+ return false;
+ if( $chown )
+ $this->chown($path,$chown);
+ if( $chgrp )
+ $this->chgrp($path,$chgrp);
+ return true;
+ }
+
+ function rmdir($path,$recursive=false){
+ if( ! $recursive )
+ return @rmdir($path);
+ //recursive:
+ $filelist = $this->dirlist($path);
+ foreach($filelist as $filename=>$det){
+ if ( '/' == substr($filename,-1,1) )
+ $this->rmdir($path.'/'.$filename,$recursive);
+ @rmdir($filename);
+ }
+ return @rmdir($path);
+ }
+
+ function dirlist($path,$incdot=false,$recursive=false){
+ if( $this->is_file($path) ){
+ $limitFile = basename($path);
+ $path = dirname($path);
+ } else {
+ $limitFile = false;
+ }
+ if( ! $this->is_dir($path) )
+ return false;
+
+ $ret = array();
+ $dir = dir($path);
+ while (false !== ($entry = $dir->read())) {
+ $struc = array();
+ $struc['name'] = $entry;
+
+ if( '.' == $struc['name'][0] && !$incdot)
+ continue;
+ if( $limitFile && $struc['name'] != $limitFile)
+ continue;
+
+ $struc['perms'] = $this->gethchmod($path.'/'.$entry);
+ $struc['permsn'] = $this->getnumchmodfromh($struc['perms']);
+ $struc['number'] = false;
+ $struc['owner'] = $this->owner($path.'/'.$entry);
+ $struc['group'] = $this->group($path.'/'.$entry);
+ $struc['size'] = $this->size($path.'/'.$entry);
+ $struc['lastmodunix']= $this->mtime($path.'/'.$entry);
+ $struc['lastmod'] = date('M j',$struc['lastmodunix']);
+ $struc['time'] = date('h:i:s',$struc['lastmodunix']);
+ $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
+ if ('d' == $struc['type'] ){
+ $struc['files'] = array();
+
+ if( $incdot ){
+ //We're including the doted starts
+ if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
+ if ($recursive)
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ }
+ } else { //No dots
+ if ($recursive)
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ }
+ }
+ //File
+ $ret[$struc['name']] = $struc;
+ }
+ $dir->close();
+ unset($dir);
+ return $ret;
+ }
+
+ function __destruct(){
+ return;
+ }
+}
+?>
diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php
new file mode 100644
index 0000000..a8a3585
--- /dev/null
+++ b/wp-admin/includes/class-wp-filesystem-ftpext.php
@@ -0,0 +1,480 @@
+<?php
+class WP_Filesystem_FTPext{
+ var $link;
+ var $timeout = 5;
+ var $errors = array();
+ var $options = array();
+
+ var $wp_base = '';
+ var $permission = null;
+
+ var $filetypes = array(
+ 'php'=>FTP_ASCII,
+ 'css'=>FTP_ASCII,
+ 'txt'=>FTP_ASCII,
+ 'js'=>FTP_ASCII,
+ 'html'=>FTP_ASCII,
+ 'htm'=>FTP_ASCII,
+ 'xml'=>FTP_ASCII,
+
+ 'jpg'=>FTP_BINARY,
+ 'png'=>FTP_BINARY,
+ 'gif'=>FTP_BINARY,
+ 'bmp'=>FTP_BINARY
+ );
+
+ function WP_Filesystem_FTPext($opt='') {
+ $this->errors = new WP_Error();
+
+ //Check if possible to use ftp functions.
+ if ( ! extension_loaded('ftp') ) {
+ $this->errors->add('no_ftp_ext', __('The ftp PHP extension is not available'));
+ return false;
+ }
+
+ // Set defaults:
+ if ( empty($opt['port']) )
+ $this->options['port'] = 21;
+ else
+ $this->options['port'] = $opt['port'];
+
+ if ( empty($opt['hostname']) )
+ $this->errors->add('empty_hostname', __('FTP hostname is required'));
+ else
+ $this->options['hostname'] = $opt['hostname'];
+
+ if ( isset($opt['base']) && ! empty($opt['base']) )
+ $this->wp_base = $opt['base'];
+
+ // Check if the options provided are OK.
+ if ( empty ($opt['username']) )
+ $this->errors->add('empty_username', __('FTP username is required'));
+ else
+ $this->options['username'] = $opt['username'];
+
+ if ( empty ($opt['password']) )
+ $this->errors->add('empty_password', __('FTP password is required'));
+ else
+ $this->options['password'] = $opt['password'];
+
+ $this->options['ssl'] = ( !empty($opt['ssl']) );
+ }
+
+ function connect(){
+ if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') ) {
+ $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);
+ } else {
+ $this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);
+ }
+
+ if ( ! $this->link ) {
+ $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
+ return false;
+ }
+
+ if ( ! @ftp_login($this->link,$this->options['username'], $this->options['password']) ) {
+ $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
+ return false;
+ }
+
+ return true;
+ }
+
+ function setDefaultPermissions($perm){
+ $this->permission = $perm;
+ }
+
+ function find_base_dir($base = '.',$echo = false){
+ $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
+ if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
+ if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
+ $abspath = $mat[1];
+ }
+
+ if( empty( $base ) || '.' == $base ) $base = $this->cwd();
+ if( empty( $base ) ) $base = '/';
+ if( '/' != substr($base, -1) ) $base .= '/';
+
+ if($echo) echo __('Changing to ') . $base .'<br>';
+ if( false === $this->chdir($base) )
+ return false;
+
+ if( $this->exists($base . 'wp-settings.php') ){
+ if($echo) echo __('Found ') . $base . 'wp-settings.php<br>';
+ $this->wp_base = $base;
+ return $this->wp_base;
+ }
+
+ if( strpos($abspath, $base) > 0)
+ $arrPath = split('/',substr($abspath,strpos($abspath, $base)));
+ else
+ $arrPath = split('/',$abspath);
+
+ for($i = 0; $i <= count($arrPath); $i++)
+ if( $arrPath[ $i ] == '' ) unset( $arrPath[ $i ] );
+
+ foreach($arrPath as $key=>$folder){
+ if( $this->is_dir($base . $folder) ){
+ if($echo) echo __('Found ') . $folder . ' ' . __('Changing to') . ' ' . $base . $folder . '/<br>';
+ return $this->find_base_dir($base . $folder . '/',$echo);
+ }
+ }
+
+ if( $base == '/' )
+ return false;
+ //If we get this far, somethings gone wrong, change to / and restart the process.
+ return $this->find_base_dir('/',$echo);
+ }
+ function get_base_dir($base = '.', $echo=false){
+ if( empty($this->wp_base) )
+ $this->wp_base = $this->find_base_dir($base,$echo);
+ return $this->wp_base;
+ }
+ function get_contents($file,$type='',$resumepos=0){
+ if( empty($type) ){
+ $extension = substr(strrchr($file, "."), 1);
+ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
+ }
+ $temp = tmpfile();
+ if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) )
+ return false;
+ fseek($temp, 0); //Skip back to the start of the file being written to
+ $contents = '';
+ while (!feof($temp)) {
+ $contents .= fread($temp, 8192);
+ }
+ fclose($temp);
+ return $contents;
+ }
+ function get_contents_array($file){
+ return explode("\n",$this->get_contents($file));
+ }
+ function put_contents($file,$contents,$type=''){
+ if( empty($type) ){
+ $extension = substr(strrchr($filename, "."), 1);
+ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
+ }
+ $temp = tmpfile();
+ fwrite($temp,$contents);
+ fseek($temp, 0); //Skip back to the start of the file being written to
+ $ret = @ftp_fput($this->link,$file,$temp,$type);
+ fclose($temp);
+ return $ret;
+ }
+ function cwd(){
+ return ftp_pwd($this->link);
+ }
+ function chdir($dir){
+ return @ftp_chdir($dir);
+ }
+ function chgrp($file,$group,$recursive=false){
+ return false;
+ }
+ function chmod($file,$mode=false,$recursive=false){
+ if( ! $mode )
+ $mode = $this->permission;
+ if( ! $mode )
+ return false;
+ if ( ! $this->exists($file) )
+ return false;
+ if ( ! $recursive || ! $this->is_dir($file) ){
+ if (!function_exists('ftp_chmod'))
+ return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
+ return @ftp_chmod($this->link,$mode,$file);
+ }
+ //Is a directory, and we want recursive
+ $filelist = $this->dirlist($file);
+ foreach($filelist as $filename){
+ $this->chmod($file.'/'.$filename,$mode,$recursive);
+ }
+ return true;
+ }
+ function chown($file,$owner,$recursive=false){
+ return false;
+ }
+ function owner($file){
+ $dir = $this->dirlist($file);
+ return $dir[$file]['owner'];
+ }
+ function getchmod($file){
+ $dir = $this->dirlist($file);
+ return $dir[$file]['permsn'];
+ }
+ function gethchmod($file){
+ //From the PHP.net page for ...?
+ $perms = $this->getchmod($file);
+ if (($perms & 0xC000) == 0xC000) {
+ // Socket
+ $info = 's';
+ } elseif (($perms & 0xA000) == 0xA000) {
+ // Symbolic Link
+ $info = 'l';
+ } elseif (($perms & 0x8000) == 0x8000) {
+ // Regular
+ $info = '-';
+ } elseif (($perms & 0x6000) == 0x6000) {
+ // Block special
+ $info = 'b';
+ } elseif (($perms & 0x4000) == 0x4000) {
+ // Directory
+ $info = 'd';
+ } elseif (($perms & 0x2000) == 0x2000) {
+ // Character special
+ $info = 'c';
+ } elseif (($perms & 0x1000) == 0x1000) {
+ // FIFO pipe
+ $info = 'p';
+ } else {
+ // Unknown
+ $info = 'u';
+ }
+
+ // Owner
+ $info .= (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ?
+ (($perms & 0x0800) ? 's' : 'x' ) :
+ (($perms & 0x0800) ? 'S' : '-'));
+
+ // Group
+ $info .= (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ?
+ (($perms & 0x0400) ? 's' : 'x' ) :
+ (($perms & 0x0400) ? 'S' : '-'));
+
+ // World
+ $info .= (($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ?
+ (($perms & 0x0200) ? 't' : 'x' ) :
+ (($perms & 0x0200) ? 'T' : '-'));
+ return $info;
+ }
+ function getnumchmodfromh($mode) {
+ $realmode = "";
+ $legal = array("","w","r","x","-");
+ $attarray = preg_split("//",$mode);
+ for($i=0;$i<count($attarray);$i++){
+ if($key = array_search($attarray[$i],$legal)){
+ $realmode .= $legal[$key];
+ }
+ }
+ $mode = str_pad($realmode,9,'-');
+ $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
+ $mode = strtr($mode,$trans);
+ $newmode = '';
+ $newmode .= $mode[0]+$mode[1]+$mode[2];
+ $newmode .= $mode[3]+$mode[4]+$mode[5];
+ $newmode .= $mode[6]+$mode[7]+$mode[8];
+ return $newmode;
+ }
+ function group($file){
+ $dir = $this->dirlist($file);
+ return $dir[$file]['group'];
+ }
+ function copy($source,$destination,$overwrite=false){
+ if( ! $overwrite && $this->exists($destination) )
+ return false;
+ $content = $this->get_contents($source);
+ if( false === $content)
+ return false;
+ return $this->put_contents($destination,$content);
+ }
+ function move($source,$destination,$overwrite=false){
+ return ftp_rename($this->link,$source,$destination);
+ }
+
+ function delete($file,$recursive=false) {
+ if ( $this->is_file($file) )
+ return @ftp_delete($this->link,$file);
+ if ( !$recursive )
+ return @ftp_rmdir($this->link,$file);
+ $filelist = $this->dirlist($file);
+ foreach ((array) $filelist as $filename => $fileinfo) {
+ $this->delete($file.'/'.$filename,$recursive);
+ }
+ return @ftp_rmdir($this->link,$file);
+ }
+
+ function exists($file){
+ $list = ftp_rawlist($this->link,$file,false);
+ if( ! $list )
+ return false;
+ return count($list) == 1 ? true : false;
+ }
+ function is_file($file){
+ return $this->is_dir($file) ? false : true;
+ }
+ function is_dir($path){
+ $cwd = $this->cwd();
+ @ftp_chdir($this->link, $path);
+ if ( $this->cwd() != $cwd ) {
+ @ftp_chdir($this->link, $cwd);
+ return true;
+ }
+ return false;
+ }
+ function is_readable($file){
+ //Get dir list, Check if the file is writable by the current user??
+ return true;
+ }
+ function is_writable($file){
+ //Get dir list, Check if the file is writable by the current user??
+ return true;
+ }
+ function atime($file){
+ return false;
+ }
+ function mtime($file){
+ return ftp_mdtm($this->link, $file);
+ }
+ function size($file){
+ return ftp_size($this->link, $file);
+ }
+ function touch($file,$time=0,$atime=0){
+ return false;
+ }
+ function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ if( !@ftp_mkdir($this->link, $path) )
+ return false;
+ if( $chmod )
+ $this->chmod($path, $chmod);
+ if( $chown )
+ $this->chown($path, $chown);
+ if( $chgrp )
+ $this->chgrp($path, $chgrp);
+ return true;
+ }
+ function rmdir($path,$recursive=false){
+ if( ! $recursive )
+ return @ftp_rmdir($this->link, $path);
+
+ //TODO: Recursive Directory delete, Have to delete files from the folder first.
+ //$dir = $this->dirlist($path);
+ //foreach($dir as $file)
+
+ }
+
+ function parselisting($line) {
+ $is_windows = ($this->OS_remote == FTP_OS_Windows);
+ if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
+ $b = array();
+ if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+ $b['isdir'] = ($lucifer[7]=="<DIR>");
+ if ( $b['isdir'] )
+ $b['type'] = 'd';
+ else
+ $b['type'] = 'f';
+ $b['size'] = $lucifer[7];
+ $b['month'] = $lucifer[1];
+ $b['day'] = $lucifer[2];
+ $b['year'] = $lucifer[3];
+ $b['hour'] = $lucifer[4];
+ $b['minute'] = $lucifer[5];
+ $b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);
+ $b['am/pm'] = $lucifer[6];
+ $b['name'] = $lucifer[8];
+ } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
+ //echo $line."\n";
+ $lcount=count($lucifer);
+ if ($lcount<8) return '';
+ $b = array();
+ $b['isdir'] = $lucifer[0]{0} === "d";
+ $b['islink'] = $lucifer[0]{0} === "l";
+ if ( $b['isdir'] )
+ $b['type'] = 'd';
+ elseif ( $b['islink'] )
+ $b['type'] = 'l';
+ else
+ $b['type'] = 'f';
+ $b['perms'] = $lucifer[0];
+ $b['number'] = $lucifer[1];
+ $b['owner'] = $lucifer[2];
+ $b['group'] = $lucifer[3];
+ $b['size'] = $lucifer[4];
+ if ($lcount==8) {
+ sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']);
+ sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']);
+ $b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']);
+ $b['name'] = $lucifer[7];
+ } else {
+ $b['month'] = $lucifer[5];
+ $b['day'] = $lucifer[6];
+ if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
+ $b['year'] = date("Y");
+ $b['hour'] = $l2[1];
+ $b['minute'] = $l2[2];
+ } else {
+ $b['year'] = $lucifer[7];
+ $b['hour'] = 0;
+ $b['minute'] = 0;
+ }
+ $b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));
+ $b['name'] = $lucifer[8];
+ }
+ }
+
+ return $b;
+ }
+
+ function dirlist($path='.',$incdot=false,$recursive=false){
+ if( $this->is_file($path) ){
+ $limitFile = basename($path);
+ $path = dirname($path) . '/';
+ } else {
+ $limitFile = false;
+ }
+ //if( ! $this->is_dir($path) )
+ // return false;
+ $list = ftp_rawlist($this->link , '-a ' . $path, false);
+ if ( $list === false )
+ return false;
+
+ $dirlist = array();
+ foreach ( $list as $k => $v ) {
+ $entry = $this->parselisting($v);
+ if ( empty($entry) )
+ continue;
+
+ if ( $entry["name"]=="." or $entry["name"]==".." )
+ continue;
+
+ $dirlist[$entry['name']] = $entry;
+ }
+
+ if ( ! $dirlist )
+ return false;
+ if ( empty($dirlist) )
+ return array();
+
+ $ret = array();
+ foreach ( $dirlist as $struc ) {
+
+ if ( 'd' == $struc['type'] ) {
+ $struc['files'] = array();
+
+ if ( $incdot ){
+ //We're including the doted starts
+ if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
+ if ($recursive)
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ }
+ } else { //No dots
+ if ($recursive)
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ }
+ }
+ //File
+ $ret[$struc['name']] = $struc;
+ }
+ return $ret;
+ }
+
+ function __destruct(){
+ if( $this->link )
+ ftp_close($this->link);
+ }
+}
+
+?>
diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php
new file mode 100644
index 0000000..15ab390
--- /dev/null
+++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php
@@ -0,0 +1,426 @@
+<?php
+class WP_Filesystem_ftpsockets{
+ var $ftp = false;
+ var $timeout = 5;
+ var $errors;
+ var $options = array();
+
+ var $wp_base = '';
+ var $permission = null;
+
+ var $filetypes = array(
+ 'php'=>FTP_ASCII,
+ 'css'=>FTP_ASCII,
+ 'txt'=>FTP_ASCII,
+ 'js'=>FTP_ASCII,
+ 'html'=>FTP_ASCII,
+ 'htm'=>FTP_ASCII,
+ 'xml'=>FTP_ASCII,
+
+ 'jpg'=>FTP_BINARY,
+ 'png'=>FTP_BINARY,
+ 'gif'=>FTP_BINARY,
+ 'bmp'=>FTP_BINARY
+ );
+
+ function WP_Filesystem_ftpsockets($opt='') {
+ $this->errors = new WP_Error();
+
+ //Check if possible to use ftp functions.
+ if( ! @include_once ABSPATH . 'wp-admin/includes/class-ftp.php' )
+ return false;
+ $this->ftp = new ftp();
+
+ //Set defaults:
+ if ( empty($opt['port']) )
+ $this->options['port'] = 21;
+ else
+ $this->options['port'] = $opt['port'];
+
+ if ( empty($opt['hostname']) )
+ $this->errors->add('empty_hostname', __('FTP hostname is required'));
+ else
+ $this->options['hostname'] = $opt['hostname'];
+
+ if ( isset($opt['base']) && ! empty($opt['base']) )
+ $this->wp_base = $opt['base'];
+
+ // Check if the options provided are OK.
+ if ( empty ($opt['username']) )
+ $this->errors->add('empty_username', __('FTP username is required'));
+ else
+ $this->options['username'] = $opt['username'];
+
+ if ( empty ($opt['password']) )
+ $this->errors->add('empty_password', __('FTP password is required'));
+ else
+ $this->options['password'] = $opt['password'];
+ }
+
+ function connect() {
+ if ( ! $this->ftp )
+ return false;
+
+ //$this->ftp->Verbose = true;
+
+ if ( ! $this->ftp->SetServer($this->options['hostname'], $this->options['port']) ) {
+ $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
+ return false;
+ }
+ if ( ! $this->ftp->connect() ) {
+ $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
+ return false;
+ }
+
+ if ( ! $this->ftp->login($this->options['username'], $this->options['password']) ) {
+ $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
+ return false;
+ }
+
+ $this->ftp->SetType(FTP_AUTOASCII);
+ $this->ftp->Passive(true);
+ return true;
+ }
+
+ function setDefaultPermissions($perm) {
+ $this->permission = $perm;
+ }
+
+ function find_base_dir($base = '.',$echo = false) {
+ $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
+ if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
+ if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
+ $abspath = $mat[1];
+ }
+
+ if( empty( $base ) || '.' == $base ) $base = $this->cwd();
+ if( empty( $base ) ) $base = '/';
+ if( '/' != substr($base, -1) ) $base .= '/';
+
+ if($echo) echo __('Changing to ') . $base .'<br>';
+ if( false === $this->chdir($base) )
+ return false;
+
+ if( $this->exists($base . 'wp-settings.php') ){
+ if($echo) echo __('Found ') . $base . 'wp-settings.php<br>';
+ $this->wp_base = $base;
+ return $this->wp_base;
+ }
+
+ if( strpos($abspath, $base) > 0)
+ $arrPath = split('/',substr($abspath,strpos($abspath, $base)));
+ else
+ $arrPath = split('/',$abspath);
+
+ for($i = 0; $i <= count($arrPath); $i++)
+ if( $arrPath[ $i ] == '' ) unset( $arrPath[ $i ] );
+
+ foreach($arrPath as $key=>$folder){
+ if( $this->is_dir($base . $folder) ){
+ if($echo) echo __('Found ') . $folder . ' ' . __('Changing to') . ' ' . $base . $folder . '/<br>';
+ return $this->find_base_dir($base . $folder . '/',$echo);
+ }
+ }
+
+ if( $base == '/' )
+ return false;
+ //If we get this far, somethings gone wrong, change to / and restart the process.
+ return $this->find_base_dir('/',$echo);
+ }
+
+ function get_base_dir($base = '.', $echo = false){
+ if( empty($this->wp_base) )
+ $this->wp_base = $this->find_base_dir($base, $echo);
+ return $this->wp_base;
+ }
+
+ function get_contents($file,$type='',$resumepos=0){
+ if( ! $this->exists($file) )
+ return false;
+
+ if( empty($type) ){
+ $extension = substr(strrchr($file, "."), 1);
+ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
+ }
+ $this->ftp->SetType($type);
+ $temp = tmpfile();
+ if ( ! $this->ftp->fget($temp, $file) ) {
+ fclose($temp);
+ return ''; //Blank document, File does exist, Its just blank.
+ }
+ fseek($temp, 0); //Skip back to the start of the file being written to
+ $contents = '';
+ while ( !feof($temp) )
+ $contents .= fread($temp, 8192);
+ fclose($temp);
+ return $contents;
+ }
+
+ function get_contents_array($file){
+ return explode("\n",$this->get_contents($file));
+ }
+
+ function put_contents($file,$contents,$type=''){
+ if( empty($type) ){
+ $extension = substr(strrchr($file, "."), 1);
+ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
+ }
+ $this->ftp->SetType($type);
+
+ $temp = tmpfile();
+ fwrite($temp,$contents);
+ fseek($temp, 0); //Skip back to the start of the file being written to
+ $ret = $this->ftp->fput($file, $temp);
+ fclose($temp);
+ return $ret;
+ }
+
+ function cwd(){
+ return $this->ftp->pwd();
+ }
+
+ function chdir($file){
+ return $this->ftp->chdir($file);
+ }
+
+ function chgrp($file,$group,$recursive=false){
+ return false;
+ }
+
+ function chmod($file,$mode=false,$recursive=false){
+ if( ! $mode )
+ $mode = $this->permission;
+ if( ! $mode )
+ return false;
+ //if( ! $this->exists($file) )
+ // return false;
+ if( ! $recursive || ! $this->is_dir($file) ){
+ return $this->ftp->chmod($file,$mode);
+ }
+ //Is a directory, and we want recursive
+ $filelist = $this->dirlist($file);
+ foreach($filelist as $filename){
+ $this->chmod($file.'/'.$filename,$mode,$recursive);
+ }
+ return true;
+ }
+
+ function chown($file,$owner,$recursive=false){
+ return false;
+ }
+
+ function owner($file){
+ $dir = $this->dirlist($file);
+ return $dir[$file]['owner'];
+ }
+
+ function getchmod($file){
+ $dir = $this->dirlist($file);
+ return $dir[$file]['permsn'];
+ }
+
+ function gethchmod($file){
+ //From the PHP.net page for ...?
+ $perms = $this->getchmod($file);
+ if (($perms & 0xC000) == 0xC000) {
+ // Socket
+ $info = 's';
+ } elseif (($perms & 0xA000) == 0xA000) {
+ // Symbolic Link
+ $info = 'l';
+ } elseif (($perms & 0x8000) == 0x8000) {
+ // Regular
+ $info = '-';
+ } elseif (($perms & 0x6000) == 0x6000) {
+ // Block special
+ $info = 'b';
+ } elseif (($perms & 0x4000) == 0x4000) {
+ // Directory
+ $info = 'd';
+ } elseif (($perms & 0x2000) == 0x2000) {
+ // Character special
+ $info = 'c';
+ } elseif (($perms & 0x1000) == 0x1000) {
+ // FIFO pipe
+ $info = 'p';
+ } else {
+ // Unknown
+ $info = 'u';
+ }
+
+ // Owner
+ $info .= (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ?
+ (($perms & 0x0800) ? 's' : 'x' ) :
+ (($perms & 0x0800) ? 'S' : '-'));
+
+ // Group
+ $info .= (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ?
+ (($perms & 0x0400) ? 's' : 'x' ) :
+ (($perms & 0x0400) ? 'S' : '-'));
+
+ // World
+ $info .= (($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ?
+ (($perms & 0x0200) ? 't' : 'x' ) :
+ (($perms & 0x0200) ? 'T' : '-'));
+ return $info;
+ }
+
+ function getnumchmodfromh($mode) {
+ $realmode = "";
+ $legal = array("","w","r","x","-");
+ $attarray = preg_split("//",$mode);
+ for($i=0;$i<count($attarray);$i++){
+ if($key = array_search($attarray[$i],$legal)){
+ $realmode .= $legal[$key];
+ }
+ }
+ $mode = str_pad($realmode,9,'-');
+ $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
+ $mode = strtr($mode,$trans);
+ $newmode = '';
+ $newmode .= $mode[0]+$mode[1]+$mode[2];
+ $newmode .= $mode[3]+$mode[4]+$mode[5];
+ $newmode .= $mode[6]+$mode[7]+$mode[8];
+ return $newmode;
+ }
+
+ function group($file){
+ $dir = $this->dirlist($file);
+ return $dir[$file]['group'];
+ }
+
+ function copy($source,$destination,$overwrite=false){
+ if( ! $overwrite && $this->exists($destination) )
+ return false;
+
+ $content = $this->get_contents($source);
+ if ( false === $content )
+ return false;
+
+ return $this->put_contents($destination,$content);
+ }
+
+ function move($source,$destination,$overwrite=false){
+ return $this->ftp->rename($source,$destination);
+ }
+
+ function delete($file,$recursive=false) {
+ if ( $this->is_file($file) )
+ return $this->ftp->delete($file);
+ if ( !$recursive )
+ return $this->ftp->rmdir($file);
+
+ return $this->ftp->mdel($file);
+ }
+
+ function exists($file){
+ return $this->ftp->is_exists($file);
+ }
+
+ function is_file($file){
+ return $this->is_dir($file) ? false : true;
+ }
+
+ function is_dir($path){
+ $cwd = $this->cwd();
+ if ( $this->chdir($path) ) {
+ $this->chdir($cwd);
+ return true;
+ }
+ return false;
+ }
+
+ function is_readable($file){
+ //Get dir list, Check if the file is writable by the current user??
+ return true;
+ }
+
+ function is_writable($file){
+ //Get dir list, Check if the file is writable by the current user??
+ return true;
+ }
+
+ function atime($file){
+ return false;
+ }
+
+ function mtime($file){
+ return $this->ftp->mdtm($file);
+ }
+
+ function size($file){
+ return $this->ftp->filesize($file);
+ }
+
+ function touch($file,$time=0,$atime=0){
+ return false;
+ }
+
+ function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ if( ! $this->ftp->mkdir($path) )
+ return false;
+ if( $chmod )
+ $this->chmod($path, $chmod);
+ if( $chown )
+ $this->chown($path, $chown);
+ if( $chgrp )
+ $this->chgrp($path, $chgrp);
+ return true;
+ }
+
+ function rmdir($path,$recursive=false){
+ if( ! $recursive )
+ return $this->ftp->rmdir($path);
+
+ return $this->ftp->mdel($path);
+ }
+
+ function dirlist($path='.',$incdot=false,$recursive=false){
+ if( $this->is_file($path) ){
+ $limitFile = basename($path);
+ $path = dirname($path) . '/';
+ } else {
+ $limitFile = false;
+ }
+ //if( ! $this->is_dir($path) )
+ // return false;
+ $list = $this->ftp->dirlist($path);
+ if( ! $list )
+ return false;
+ if( empty($list) )
+ return array();
+
+ $ret = array();
+ foreach ( $list as $struc ) {
+
+ if ( 'd' == $struc['type'] ) {
+ $struc['files'] = array();
+
+ if ( $incdot ){
+ //We're including the doted starts
+ if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
+ if ($recursive)
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ }
+ } else { //No dots
+ if ($recursive)
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ }
+ }
+ //File
+ $ret[$struc['name']] = $struc;
+ }
+ return $ret;
+ }
+
+ function __destruct(){
+ $this->ftp->quit();
+ }
+}
+?>
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
new file mode 100644
index 0000000..c675c4d
--- /dev/null
+++ b/wp-admin/includes/dashboard.php
@@ -0,0 +1,538 @@
+<?php
+
+// Registers dashboard widgets, handles POST data, sets up filters
+function wp_dashboard_setup() {
+ global $wpdb, $wp_dashboard_sidebars;
+ $update = false;
+ if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
+ $widget_options = array();
+
+
+ /* Register WP Dashboard Dynamic Sidebar */
+ register_sidebar( array(
+ 'name' => 'WordPress Dashboard',
+ 'id' => 'wp_dashboard',
+ 'before_widget' => "\t<div class='dashboard-widget-holder %2\$s' id='%1\$s'>\n\n\t\t<div class='dashboard-widget'>\n\n",
+ 'after_widget' => "\t\t</div>\n\n\t</div>\n\n",
+ 'before_title' => "\t\t\t<h3 class='dashboard-widget-title'>",
+ 'after_title' => "</h3>\n\n"
+ ) );
+
+
+ /* Register Widgets and Controls */
+
+ // Recent Comments Widget
+ if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
+ $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
+ $notice = "<a href='moderation.php'>$notice</a>";
+ } else {
+ $notice = '';
+ }
+ wp_register_sidebar_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments',
+ array( 'all_link' => 'edit-comments.php', 'notice' => $notice, 'width' => 'half' )
+ );
+
+ // Incoming Links Widget
+ if ( !isset( $widget_options['dashboard_incoming_links'] ) ) {
+ $update = true;
+ $widget_options['dashboard_incoming_links'] = array(
+ 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+ 'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+ 'items' => 5,
+ 'show_date' => 0
+ );
+ }
+ wp_register_sidebar_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_empty',
+ array( 'all_link' => $widget_options['dashboard_incoming_links']['link'], 'feed_link' => $widget_options['dashboard_incoming_links']['url'], 'width' => 'half' ),
+ 'wp_dashboard_cached_rss_widget', 'wp_dashboard_incoming_links_output'
+ );
+ wp_register_widget_control( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_rss_control', array(),
+ array( 'widget_id' => 'dashboard_incoming_links', 'form_inputs' => array( 'title' => false, 'show_summary' => false, 'show_author' => false ) )
+ );
+
+
+ // WP Plugins Widget
+ wp_register_sidebar_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_empty',
+ array( 'all_link' => 'http://wordpress.org/extend/plugins/', 'feed_link' => 'http://wordpress.org/extend/plugins/rss/topics/', 'width' => 'half' ),
+ 'wp_dashboard_cached_rss_widget', 'wp_dashboard_plugins_output',
+ array( 'http://wordpress.org/extend/plugins/rss/browse/popular/', 'http://wordpress.org/extend/plugins/rss/browse/new/', 'http://wordpress.org/extend/plugins/rss/browse/updated/' )
+ );
+
+ // Primary feed (Dev Blog) Widget
+ if ( !isset( $widget_options['dashboard_primary'] ) ) {
+ $update = true;
+ $widget_options['dashboard_primary'] = array(
+ 'link' => apply_filters( 'dashboard_primary_link', 'http://wordpress.org/development/' ),
+ 'url' => apply_filters( 'dashboard_primary_feed', 'http://wordpress.org/development/feed/' ),
+ 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Development Blog' ) ),
+ 'items' => 2,
+ 'show_summary' => 1,
+ 'show_author' => 0,
+ 'show_date' => 1
+ );
+ }
+ wp_register_sidebar_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_empty',
+ array( 'all_link' => $widget_options['dashboard_primary']['link'], 'feed_link' => $widget_options['dashboard_primary']['url'], 'width' => 'half', 'class' => 'widget_rss' ),
+ 'wp_dashboard_cached_rss_widget', 'wp_dashboard_rss_output'
+ );
+ wp_register_widget_control( 'dashboard_primary', __( 'Primary Feed' ), 'wp_dashboard_rss_control', array(),
+ array( 'widget_id' => 'dashboard_primary' )
+ );
+
+
+ // Secondary Feed (Planet) Widget
+ if ( !isset( $widget_options['dashboard_secondary'] ) ) {
+ $update = true;
+ $widget_options['dashboard_secondary'] = array(
+ 'link' => apply_filters( 'dashboard_secondary_link', 'http://planet.wordpress.org/' ),
+ 'url' => apply_filters( 'dashboard_secondary_feed', 'http://planet.wordpress.org/feed/' ),
+ 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
+ 'items' => 15
+ );
+ }
+ wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty',
+ array( 'all_link' => $widget_options['dashboard_secondary']['link'], 'feed_link' => $widget_options['dashboard_secondary']['url'], 'width' => 'full' ),
+ 'wp_dashboard_cached_rss_widget', 'wp_dashboard_secondary_output'
+ );
+ wp_register_widget_control( 'dashboard_secondary', __( 'Secondary Feed' ), 'wp_dashboard_rss_control', array(),
+ array( 'widget_id' => 'dashboard_secondary', 'form_inputs' => array( 'show_summary' => false, 'show_author' => false, 'show_date' => false ) )
+ );
+
+
+ /* Dashboard Widget Template
+ wp_register_sidebar_widget( $widget_id (unique slug) , $widget_title, $output_callback,
+ array(
+ 'all_link' => full url for "See All" link,
+ 'feed_link' => full url for "RSS" link,
+ 'width' => 'fourth', 'third', 'half', 'full' (defaults to 'half'),
+ 'height' => 'single', 'double' (defaults to 'single'),
+ ),
+ $wp_dashboard_empty_callback (only needed if using 'wp_dashboard_empty' as your $output_callback),
+ $arg, $arg, $arg... (further args passed to callbacks)
+ );
+
+ // optional: if you want users to be able to edit the settings of your widget, you need to register a widget_control
+ wp_register_widget_control( $widget_id, $widget_control_title, $control_output_callback,
+ array(), // leave an empty array here: oddity in widget code
+ array(
+ 'widget_id' => $widget_id, // Yes - again. This is required: oddity in widget code
+ 'arg' => an arg to pass to the $control_output_callback,
+ 'another' => another arg to pass to the $control_output_callback,
+ ...
+ )
+ );
+ */
+
+ // Hook to register new widgets
+ do_action( 'wp_dashboard_setup' );
+
+ // Hard code the sidebar's widgets and order
+ $dashboard_widgets = array();
+ $dashboard_widgets[] = 'dashboard_recent_comments';
+ $dashboard_widgets[] = 'dashboard_incoming_links';
+ $dashboard_widgets[] = 'dashboard_primary';
+ if ( current_user_can( 'activate_plugins' ) )
+ $dashboard_widgets[] = 'dashboard_plugins';
+ $dashboard_widgets[] = 'dashboard_secondary';
+
+ // Filter widget order
+ $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets );
+
+ $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets, 'array_version' => 3.5 );
+
+ add_filter( 'dynamic_sidebar_params', 'wp_dashboard_dynamic_sidebar_params' );
+
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
+ ob_start(); // hack - but the same hack wp-admin/widgets.php uses
+ wp_dashbaord_trigger_widget_control( $_POST['widget_id'] );
+ ob_end_clean();
+ wp_redirect( remove_query_arg( 'edit' ) );
+ exit;
+ }
+
+ if ( $update )
+ update_option( 'dashboard_widget_options', $widget_options );
+}
+
+// Echoes out the dashboard
+function wp_dashboard() {
+ echo "<div id='dashboard-widgets'>\n\n";
+
+ // We're already filtering dynamic_sidebar_params obove
+ add_filter( 'option_sidebars_widgets', 'wp_dashboard_sidebars_widgets' ); // here there be hackery
+ dynamic_sidebar( 'wp_dashboard' );
+ remove_filter( 'option_sidebars_widgets', 'wp_dashboard_sidebars_widgets' );
+
+ echo "<br class='clear' />\n</div>\n\n\n";
+}
+
+// Makes sidebar_widgets option reflect the dashboard settings
+function wp_dashboard_sidebars_widgets() { // hackery
+ return $GLOBALS['wp_dashboard_sidebars'];
+}
+
+// Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget)
+// Switches widget to edit mode if $_GET['edit']
+function wp_dashboard_dynamic_sidebar_params( $params ) {
+ global $wp_registered_widgets, $wp_registered_widget_controls;
+
+ $sidebar_defaults = array('widget_id' => 0, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
+ extract( $sidebar_defaults, EXTR_PREFIX_ALL, 'sidebar' );
+ extract( $params[0], EXTR_PREFIX_ALL, 'sidebar' );
+
+ if ( !isset($wp_registered_widgets[$sidebar_widget_id]) || !is_array($wp_registered_widgets[$sidebar_widget_id]) ) {
+ return $params;
+ }
+ $widget_defaults = array('id' => '', 'width' => '', 'height' => '', 'class' => '', 'feed_link' => '', 'all_link' => '', 'notice' => false, 'error' => false);
+ extract( $widget_defaults, EXTR_PREFIX_ALL, 'widget' );
+ extract( $wp_registered_widgets[$sidebar_widget_id], EXTR_PREFIX_ALL, 'widget' );
+
+ $the_classes = array();
+ if ( in_array($widget_width, array( 'third', 'fourth', 'full' ) ) )
+ $the_classes[] = $widget_width;
+
+ if ( 'double' == $widget_height )
+ $the_classes[] = 'double';
+
+ if ( $widget_class )
+ $the_classes[] = $widget_class;
+
+ // Add classes to the widget holder
+ if ( $the_classes )
+ $sidebar_before_widget = str_replace( "<div class='dashboard-widget-holder ", "<div class='dashboard-widget-holder " . join( ' ', $the_classes ) . ' ', $sidebar_before_widget );
+
+ $links = array();
+ if ( $widget_all_link )
+ $links[] = '<a href="' . clean_url( $widget_all_link ) . '">' . __( 'See&nbsp;All' ) . '</a>';
+
+ $content_class = 'dashboard-widget-content';
+ if ( current_user_can( 'edit_dashboard' ) && isset($wp_registered_widget_controls[$widget_id]) && is_callable($wp_registered_widget_controls[$widget_id]['callback']) ) {
+ // Switch this widget to edit mode
+ if ( isset($_GET['edit']) && $_GET['edit'] == $widget_id ) {
+ $content_class .= ' dashboard-widget-control';
+ $wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty';
+ $sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name'];
+ $params[1] = 'wp_dashbaord_trigger_widget_control';
+ $sidebar_before_widget .= '<form action="' . remove_query_arg( 'edit' ) . '" method="post">';
+ $sidebar_after_widget = "<div class='dashboard-widget-submit'><input type='hidden' name='sidebar' value='wp_dashboard' /><input type='hidden' name='widget_id' value='$widget_id' /><input type='submit' value='" . __( 'Save' ) . "' /></div></form>$sidebar_after_widget";
+ $links[] = '<a href="' . remove_query_arg( 'edit' ) . '">' . __( 'Cancel' ) . '</a>';
+ } else {
+ $links[] = '<a href="' . add_query_arg( 'edit', $widget_id ) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>';
+ }
+ }
+
+ if ( $widget_feed_link )
+ $links[] = '<img class="rss-icon" src="' . get_option( 'siteurl' ) . '/' . WPINC . '/images/rss.png" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
+
+ $links = apply_filters( "wp_dashboard_widget_links_$widget_id", $links );
+
+ // Add links to widget's title bar
+ if ( $links ) {
+ $sidebar_before_title .= '<span>';
+ $sidebar_after_title = '</span><small>' . join( '&nbsp;|&nbsp;', $links ) . "</small><br class='clear' />$sidebar_after_title";
+ }
+
+ // Could have put this in widget-content. Doesn't really matter
+ if ( $widget_notice )
+ $sidebar_after_title .= "\t\t\t<div class='dashboard-widget-notice'>$widget_notice</div>\n\n";
+
+ if ( $widget_error )
+ $sidebar_after_title .= "\t\t\t<div class='dashboard-widget-error'>$widget_error</div>\n\n";
+
+ $sidebar_after_title .= "\t\t\t<div class='$content_class'>\n\n";
+
+ $sidebar_after_widget .= "\t\t\t</div>\n\n";
+
+ foreach( array_keys( $params[0] ) as $key )
+ $$key = ${'sidebar_' . $key};
+
+ $params[0] = compact( array_keys( $params[0] ) );
+
+ return $params;
+}
+
+
+/* Dashboard Widgets */
+
+function wp_dashboard_recent_comments( $sidebar_args ) {
+ global $comment;
+ extract( $sidebar_args, EXTR_SKIP );
+
+ echo $before_widget;
+
+ echo $before_title;
+ echo $widget_name;
+ echo $after_title;
+
+ $lambda = create_function( '', 'return 5;' );
+ add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter
+ $comments_query = new WP_Query('feed=rss2&withcomments=1');
+ remove_filter( 'option_posts_per_rss', $lambda );
+
+ $is_first = true;
+
+ if ( $comments_query->have_comments() ) {
+ while ( $comments_query->have_comments() ) { $comments_query->the_comment();
+
+ $comment_post_url = get_permalink( $comment->comment_post_ID );
+ $comment_post_title = get_the_title( $comment->comment_post_ID );
+ $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
+ $comment_link = '<a class="comment-link" href="' . get_comment_link() . '">#</a>';
+ $comment_meta = sprintf( __( 'From <strong>%1$s</strong> on %2$s %3$s' ), get_comment_author(), $comment_post_link, $comment_link );
+
+ if ( $is_first ) : $is_first = false;
+?>
+ <blockquote><p>&#8220;<?php comment_excerpt(); ?>&#8221;</p></blockquote>
+ <p class='comment-meta'><?php echo $comment_meta; ?></p>
+
+ <ul id="dashboard-comments-list">
+<?php
+ else :
+?>
+
+ <li class='comment-meta'><?php echo $comment_meta; ?></li>
+<?php
+ endif;
+ }
+?>
+
+ </ul>
+
+<?php
+
+ }
+
+ echo $after_widget;
+}
+
+// $sidebar_args are handled by wp_dashboard_empty()
+function wp_dashboard_incoming_links_output() {
+ $widgets = get_option( 'dashboard_widget_options' );
+ @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
+ $rss = @fetch_rss( $url );
+ if ( isset($rss->items) && 1 < count($rss->items) ) {// Technorati returns a 1-item feed when it has no results
+
+ echo "<ul>\n";
+
+ $rss->items = array_slice($rss->items, 0, $items);
+ foreach ( $rss->items as $item ) {
+ $publisher = '';
+ $site_link = '';
+ $link = '';
+ $content = '';
+ $date = '';
+ $link = clean_url( strip_tags( $item['link'] ) );
+
+ if ( isset( $item['author_uri'] ) )
+ $site_link = clean_url( strip_tags( $item['author_uri'] ) );
+
+ if ( !$publisher = wp_specialchars( strip_tags( isset($item['dc']['publisher']) ? $item['dc']['publisher'] : $item['author_name'] ) ) )
+ $publisher = __( 'Somebody' );
+ if ( $site_link )
+ $publisher = "<a href='$site_link'>$publisher</a>";
+ else
+ $publisher = "<strong>$publisher</strong>";
+
+ if ( isset($item['description']) )
+ $content = $item['description'];
+ elseif ( isset($item['summary']) )
+ $content = $item['summary'];
+ elseif ( isset($item['atom_content']) )
+ $content = $item['atom_content'];
+ else
+ $content = __( 'something' );
+ $content = wp_html_excerpt($content, 50) . ' ...';
+ if ( $link )
+ $text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' );
+ else
+ $text = _c( '%1$s linked here saying, "%3$s"|feed_display' );
+
+ if ( $show_date ) {
+ if ( $show_author || $show_summary )
+ $text .= _c( ' on %4$s|feed_display' );
+ $date = wp_specialchars( strip_tags( isset($item['pubdate']) ? $item['pubdate'] : $item['published'] ) );
+ $date = strtotime( $date );
+ $date = gmdate( get_option( 'date_format' ), $date );
+ }
+
+ echo "\t<li>" . sprintf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ) . "</li>\n";
+ }
+
+ echo "</ul>\n";
+
+ } else {
+ echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. They have found no incoming links found&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
+ }
+}
+
+// $sidebar_args are handled by wp_dashboard_empty()
+function wp_dashboard_rss_output( $widget_id ) {
+ $widgets = get_option( 'dashboard_widget_options' );
+ wp_widget_rss_output( $widgets[$widget_id] );
+}
+
+// $sidebar_args are handled by wp_dashboard_empty()
+function wp_dashboard_secondary_output() {
+ $widgets = get_option( 'dashboard_widget_options' );
+ @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
+ $rss = @fetch_rss( $url );
+ if ( !isset($rss->items) || 0 == count($rss->items) )
+ return false;
+
+ echo "<ul id='planetnews'>\n";
+
+ $rss->items = array_slice($rss->items, 0, $items);
+ foreach ($rss->items as $item ) {
+ $title = wp_specialchars($item['title']);
+ $author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
+ $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
+ $link = clean_url($item['link']);
+
+ echo "\t<li><a href='$link'><span class='post'>$post</span><span class='hidden'> - </span><cite>$author</cite></a></li>\n";
+ }
+
+ echo "</ul>\n<br class='clear' />\n";
+}
+
+// $sidebar_args are handled by wp_dashboard_empty()
+function wp_dashboard_plugins_output() {
+ $popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
+ $new = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
+ $updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
+
+ foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) {
+ if ( !isset($$feed->items) || 0 == count($$feed->items) )
+ continue;
+
+ $$feed->items = array_slice($$feed->items, 0, 5);
+ $item_key = array_rand($$feed->items);
+
+ // Eliminate some common badly formed plugin descriptions
+ while ( ( null !== $item_key = array_rand($$feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) )
+ unset($$feed->items[$item_key]);
+
+ if ( !isset($$feed->items[$item_key]) )
+ continue;
+
+ $item = $$feed->items[$item_key];
+
+ // current bbPress feed item titles are: user on "topic title"
+ if ( preg_match( '/"(.*)"/s', $item['title'], $matches ) )
+ $title = $matches[1];
+ else // but let's make it forward compatible if things change
+ $title = $item['title'];
+ $title = wp_specialchars( $title );
+
+ $description = wp_specialchars( strip_tags(html_entity_decode($item['description'], ENT_QUOTES)) );
+
+ list($link, $frag) = explode( '#', $item['link'] );
+
+ $link = clean_url($link);
+ $dlink = rtrim($link, '/') . '/download/';
+
+ echo "<h4>$label</h4>\n";
+ echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$dlink'>" . __( 'Download' ) . "</a>)</span>\n";
+ echo "<p>$description</p>\n";
+ }
+}
+
+// Checks to see if all of the feed url in $check_urls are cached.
+// If $check_urls is empty, look for the rss feed url found in the dashboard widget optios of $widget_id.
+// If cached, call $callback, a function that echoes out output for this widget.
+// If not cache, echo a "Loading..." stub which is later replaced by AJAX call (see top of /wp-admin/index.php)
+function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
+ $loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';
+
+ if ( empty($check_urls) ) {
+ $widgets = get_option( 'dashboard_widget_options' );
+ if ( empty($widgets[$widget_id]['url']) ) {
+ echo $loading;
+ return false;
+ }
+ $check_urls = array( $widgets[$widget_id]['url'] );
+ }
+
+
+ require_once( ABSPATH . WPINC . '/rss.php' );
+ init(); // initialize rss constants
+
+ $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
+
+ foreach ( $check_urls as $check_url ) {
+ $status = $cache->check_cache( $check_url );
+ if ( 'HIT' !== $status ) {
+ echo $loading;
+ return false;
+ }
+ }
+
+ if ( $callback && is_callable( $callback ) ) {
+ $args = array_slice( func_get_args(), 2 );
+ array_unshift( $args, $widget_id );
+ call_user_func_array( $callback, $args );
+ }
+
+ return true;
+}
+
+// Empty widget used for JS/AJAX created output.
+// Callback inserts content between before_widget and after_widget. Used when widget is in edit mode. Can also be used for custom widgets.
+function wp_dashboard_empty( $sidebar_args, $callback = false ) {
+ extract( $sidebar_args, EXTR_SKIP );
+
+ echo $before_widget;
+
+ echo $before_title;
+ echo $widget_name;
+ echo $after_title;
+
+ // When in edit mode, the callback passed to this function is the widget_control callback
+ if ( $callback && is_callable( $callback ) ) {
+ $args = array_slice( func_get_args(), 2 );
+ array_unshift( $args, $widget_id );
+ call_user_func_array( $callback, $args );
+ }
+
+ echo $after_widget;
+}
+
+/* Dashboard Widgets Controls. Ssee also wp_dashboard_empty() */
+
+// Calls widget_control callback
+function wp_dashbaord_trigger_widget_control( $widget_control_id = false ) {
+ global $wp_registered_widget_controls;
+ if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_registered_widget_controls[$widget_control_id]) && is_callable($wp_registered_widget_controls[$widget_control_id]['callback']) )
+ call_user_func_array( $wp_registered_widget_controls[$widget_control_id]['callback'], $wp_registered_widget_controls[$widget_control_id]['params'] );
+}
+
+// Sets up $args to be used as input to wp_widget_rss_form(), handles POST data from RSS-type widgets
+function wp_dashboard_rss_control( $args ) {
+ extract( $args );
+ if ( !$widget_id )
+ return false;
+
+ if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
+ $widget_options = array();
+
+ if ( !isset($widget_options[$widget_id]) )
+ $widget_options[$widget_id] = array();
+
+ $number = 1; // Hack to use wp_widget_rss_form()
+ $widget_options[$widget_id]['number'] = $number;
+
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
+ $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
+ $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
+ // title is optional. If black, fill it if possible
+ if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
+ require_once(ABSPATH . WPINC . '/rss.php');
+ $rss = fetch_rss($widget_options[$widget_id]['url']);
+ $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->channel['title']));
+ }
+ update_option( 'dashboard_widget_options', $widget_options );
+ }
+
+ wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
+}
+
+?>
diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
new file mode 100644
index 0000000..a712177
--- /dev/null
+++ b/wp-admin/includes/export.php
@@ -0,0 +1,255 @@
+<?php
+
+// version number for the export format. bump this when something changes that might affect compatibility.
+define('WXR_VERSION', '1.0');
+
+function export_wp($author='') {
+global $wpdb, $post_ids, $post;
+
+do_action('export_wp');
+
+$filename = 'wordpress.' . date('Y-m-d') . '.xml';
+
+header('Content-Description: File Transfer');
+header("Content-Disposition: attachment; filename=$filename");
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+
+$where = '';
+if ( $author and $author != 'all' ) {
+ $author_id = (int) $author;
+ $where = " WHERE post_author = '$author_id' ";
+}
+
+// grab a snapshot of post IDs, just in case it changes during the export
+$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
+
+$categories = (array) get_categories('get=all');
+$tags = (array) get_tags('get=all');
+
+function wxr_missing_parents($categories) {
+ if ( !is_array($categories) || empty($categories) )
+ return array();
+
+ foreach ( $categories as $category )
+ $parents[$category->term_id] = $category->parent;
+
+ $parents = array_unique(array_diff($parents, array_keys($parents)));
+
+ if ( $zero = array_search('0', $parents) )
+ unset($parents[$zero]);
+
+ return $parents;
+}
+
+while ( $parents = wxr_missing_parents($categories) ) {
+ $found_parents = get_categories("include=" . join(', ', $parents));
+ if ( is_array($found_parents) && count($found_parents) )
+ $categories = array_merge($categories, $found_parents);
+ else
+ break;
+}
+
+// Put them in order to be inserted with no child going before its parent
+$pass = 0;
+$passes = 1000 + count($categories);
+while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
+ if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
+ $cats[$cat->term_id] = $cat;
+ } else {
+ $categories[] = $cat;
+ }
+}
+unset($categories);
+
+function wxr_cdata($str) {
+ if ( seems_utf8($str) == false )
+ $str = utf8_encode($str);
+
+ // $str = ent2ncr(wp_specialchars($str));
+
+ $str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
+
+ return $str;
+}
+
+function wxr_site_url() {
+ global $current_site;
+
+ // mu: the base url
+ if ( isset($current_site->domain) ) {
+ return 'http://'.$current_site->domain.$current_site->path;
+ }
+ // wp: the blog url
+ else {
+ return get_bloginfo_rss('url');
+ }
+}
+
+function wxr_cat_name($c) {
+ if ( empty($c->name) )
+ return;
+
+ echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
+}
+
+function wxr_category_description($c) {
+ if ( empty($c->description) )
+ return;
+
+ echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
+}
+
+function wxr_tag_name($t) {
+ if ( empty($t->name) )
+ return;
+
+ echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
+}
+
+function wxr_tag_description($t) {
+ if ( empty($t->description) )
+ return;
+
+ echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
+}
+
+function wxr_post_taxonomy() {
+ $categories = get_the_category();
+ $tags = get_the_tags();
+ $the_list = '';
+ $filter = 'rss';
+
+ if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
+ $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
+ // for backwards compatibility
+ $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
+ // forwards compatibility: use a unique identifier for each cat to avoid clashes
+ // http://trac.wordpress.org/ticket/5447
+ $the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n";
+ }
+
+ if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
+ $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
+ $the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
+ // forwards compatibility as above
+ $the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n";
+ }
+
+ echo $the_list;
+}
+
+echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
+
+?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
+<!-- It contains information about your blog's posts, comments, and categories. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress blog follow these steps. -->
+<!-- 1. Log into that blog as an administrator. -->
+<!-- 2. Go to Manage: Import in the blog's admin panels. -->
+<!-- 3. Choose "WordPress" from the list. -->
+<!-- 4. Upload this file using the form provided on that page. -->
+<!-- 5. You will first be asked to map the authors in this export file to users -->
+<!-- on the blog. For each author, you may choose to map to an -->
+<!-- existing user on the blog or to create a new user -->
+<!-- 6. WordPress will then import each of the posts, comments, and categories -->
+<!-- contained in this file into your blog -->
+
+<?php the_generator('export');?>
+<rss version="2.0"
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
+ xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
+>
+
+<channel>
+ <title><?php bloginfo_rss('name'); ?></title>
+ <link><?php bloginfo_rss('url') ?></link>
+ <description><?php bloginfo_rss("description") ?></description>
+ <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
+ <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
+ <language><?php echo get_option('rss_language'); ?></language>
+ <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
+ <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
+ <wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
+<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
+ <wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
+<?php endforeach; endif; ?>
+<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
+ <wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
+<?php endforeach; endif; ?>
+ <?php do_action('rss2_head'); ?>
+ <?php if ($post_ids) {
+ global $wp_query;
+ $wp_query->in_the_loop = true; // Fake being in the loop.
+ // fetch 20 posts at a time rather than loading the entire table into memory
+ while ( $next_posts = array_splice($post_ids, 0, 20) ) {
+ $where = "WHERE ID IN (".join(',', $next_posts).")";
+ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
+ foreach ($posts as $post) {
+ setup_postdata($post); ?>
+<item>
+<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
+<link><?php the_permalink_rss() ?></link>
+<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
+<dc:creator><?php the_author() ?></dc:creator>
+<?php wxr_post_taxonomy() ?>
+
+<guid isPermaLink="false"><?php the_guid(); ?></guid>
+<description></description>
+<content:encoded><![CDATA[<?php echo apply_filters('the_content_export', $post->post_content); ?>]]></content:encoded>
+<wp:post_id><?php echo $post->ID; ?></wp:post_id>
+<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
+<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
+<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
+<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
+<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
+<wp:status><?php echo $post->post_status; ?></wp:status>
+<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
+<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
+<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
+<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
+<?php
+if ($post->post_type == 'attachment') { ?>
+<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>
+<?php } ?>
+<?php
+$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
+if ( $postmeta ) {
+?>
+<?php foreach( $postmeta as $meta ) { ?>
+<wp:postmeta>
+<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
+<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
+</wp:postmeta>
+<?php } ?>
+<?php } ?>
+<?php
+$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
+if ( $comments ) { foreach ( $comments as $c ) { ?>
+<wp:comment>
+<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
+<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
+<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
+<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
+<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
+<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
+<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
+<wp:comment_content><?php echo $c->comment_content; ?></wp:comment_content>
+<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
+<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
+<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
+<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
+</wp:comment>
+<?php } } ?>
+ </item>
+<?php } } } ?>
+</channel>
+</rss>
+<?php
+}
+
+?> \ No newline at end of file
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
new file mode 100644
index 0000000..b43c2da
--- /dev/null
+++ b/wp-admin/includes/media.php
@@ -0,0 +1,1225 @@
+<?php
+
+function media_upload_tabs() {
+ $_default_tabs = array(
+ 'type' => __('Choose File'), // handler action suffix => tab text
+ 'gallery' => __('Gallery'),
+ 'library' => __('Media Library'),
+ );
+
+ return apply_filters('media_upload_tabs', $_default_tabs);
+}
+
+function update_gallery_tab($tabs) {
+ global $wpdb;
+ if ( !isset($_REQUEST['post_id']) ) {
+ unset($tabs['gallery']);
+ return $tabs;
+ }
+ if ( intval($_REQUEST['post_id']) )
+ $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])));
+
+ $tabs['gallery'] = sprintf(__('Gallery (%s)'), "<span id='attachments-count'>$attachments</span>");
+
+ return $tabs;
+}
+add_filter('media_upload_tabs', 'update_gallery_tab');
+
+function the_media_upload_tabs() {
+ $tabs = media_upload_tabs();
+
+ if ( !empty($tabs) ) {
+ echo "<ul id='sidemenu'>\n";
+ if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
+ $current = $_GET['tab'];
+ else {
+ $keys = array_keys($tabs);
+ $current = array_shift($keys);
+ }
+ foreach ( $tabs as $callback => $text ) {
+ $class = '';
+ if ( $current == $callback )
+ $class = " class='current'";
+ $href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
+ $link = "<a href='$href'$class>$text</a>";
+ echo "\t<li id='tab-$callback'>$link</li>\n";
+ }
+ echo "</ul>\n";
+ }
+}
+
+function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
+
+ $html = get_image_tag($id, $alt, $title, $align, $rel, $size);
+
+ $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
+
+ if ( $url )
+ $html = "<a href='".attribute_escape($url)."'$rel>$html</a>";
+
+ $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
+
+ return $html;
+}
+
+function media_send_to_editor($html) {
+ ?>
+<script type="text/javascript">
+<!--
+top.send_to_editor('<?php echo addslashes($html); ?>');
+top.tb_remove();
+-->
+</script>
+ <?php
+ exit;
+}
+
+// this handles the file upload POST itself, creating the attachment post
+function media_handle_upload($file_id, $post_id, $post_data = array()) {
+ $overrides = array('test_form'=>false);
+ $file = wp_handle_upload($_FILES[$file_id], $overrides);
+
+ if ( isset($file['error']) )
+ return new wp_error( 'upload_error', $file['error'] );
+
+ $url = $file['url'];
+ $type = $file['type'];
+ $file = $file['file'];
+ $title = preg_replace('/\.[^.]+$/', '', basename($file));
+ $content = '';
+
+ // use image exif/iptc data for title and caption defaults if possible
+ if ( $image_meta = @wp_read_image_metadata($file) ) {
+ if ( trim($image_meta['title']) )
+ $title = $image_meta['title'];
+ if ( trim($image_meta['caption']) )
+ $content = $image_meta['caption'];
+ }
+
+ // Construct the attachment array
+ $attachment = array_merge( array(
+ 'post_mime_type' => $type,
+ 'guid' => $url,
+ 'post_parent' => $post_id,
+ 'post_title' => $title,
+ 'post_content' => $content,
+ ), $post_data );
+
+ // Save the data
+ $id = wp_insert_attachment($attachment, $file, $post_parent);
+ if ( !is_wp_error($id) ) {
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+ }
+
+ return $id;
+
+}
+
+
+// wrap iframe content (produced by $content_func) in a doctype, html head/body etc
+// any additional function args will be passed to content_func
+function wp_iframe($content_func /* ... */) {
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<head>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; WordPress</title>
+<?php
+wp_admin_css( 'css/global' );
+wp_admin_css();
+wp_admin_css( 'css/colors' );
+?>
+<script type="text/javascript">
+//<![CDATA[
+function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
+//]]>
+</script>
+<?php
+do_action('admin_print_scripts');
+do_action('admin_head');
+if ( is_string($content_func) )
+ do_action( "admin_head_{$content_func}" );
+?>
+</head>
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>>
+<?php
+ $args = func_get_args();
+ $args = array_slice($args, 1);
+ call_user_func_array($content_func, $args);
+?>
+</body>
+</html>
+<?php
+}
+
+function media_buttons() {
+ global $post_ID, $temp_ID;
+ $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
+ $context = apply_filters('media_buttons_context', __('Add media: %s'));
+ $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
+ $media_title = __('Add Media');
+ $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
+ $image_title = __('Add an Image');
+ $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
+ $video_title = __('Add Video');
+ $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
+ $audio_title = __('Add Audio');
+ $out = <<<EOF
+
+ <a href="{$image_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
+ <a href="{$video_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
+ <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
+ <a href="{$media_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
+
+EOF;
+ printf($context, $out);
+}
+add_action( 'media_buttons', 'media_buttons' );
+
+function media_buttons_head() {
+$siteurl = get_option('siteurl');
+echo "<style type='text/css' media='all'>
+ @import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?1';
+ div#TB_title {
+ background-color: #222222;
+ color: #cfcfcf;
+ }
+ div#TB_title a, div#TB_title a:visited {
+ color: #cfcfcf;
+ }
+</style>\n";
+}
+
+add_action( 'admin_print_scripts', 'media_buttons_head' );
+
+function media_admin_css() {
+ wp_admin_css('css/media');
+}
+
+add_action('media_upload_media', 'media_upload_handler');
+
+function media_upload_form_handler() {
+ check_admin_referer('media-form');
+
+ // Insert media button was clicked
+ if ( !empty($_FILES) ) {
+ // Upload File button was clicked
+
+ $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ $id = false;
+ }
+ }
+
+ if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
+ $post = $_post = get_post($attachment_id, ARRAY_A);
+ if ( isset($attachment['post_content']) )
+ $post['post_content'] = $attachment['post_content'];
+ if ( isset($attachment['post_title']) )
+ $post['post_title'] = $attachment['post_title'];
+ if ( isset($attachment['post_excerpt']) )
+ $post['post_excerpt'] = $attachment['post_excerpt'];
+
+ $post = apply_filters('attachment_fields_to_save', $post, $attachment);
+
+ if ( isset($post['errors']) ) {
+ $errors[$attachment_id] = $post['errors'];
+ unset($post['errors']);
+ }
+
+ if ( $post != $_post )
+ wp_update_post($post);
+
+ foreach ( get_attachment_taxonomies($post) as $t )
+ if ( isset($attachment[$t]) )
+ wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
+ }
+
+ if ( isset($_POST['insert-gallery']) )
+ return media_send_to_editor('[gallery]');
+
+ if ( isset($_POST['send']) ) {
+ $keys = array_keys($_POST['send']);
+ $send_id = (int) array_shift($keys);
+ $attachment = $_POST['attachments'][$send_id];
+ $html = $attachment['post_title'];
+ if ( !empty($attachment['url']) )
+ $html = "<a href='{$attachment['url']}'>$html</a>";
+ $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
+ return media_send_to_editor($html);
+ }
+
+ return $errors;
+}
+
+function media_upload_image() {
+ if ( !empty($_FILES) ) {
+ // Upload File button was clicked
+ $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+ unset($_FILES);
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ $id = false;
+ }
+ }
+
+ if ( !empty($_POST['insertonlybutton']) ) {
+ $src = $_POST['insertonly']['src'];
+ if ( !strpos($src, '://') )
+ $src = "http://$src";
+ $alt = attribute_escape($_POST['insertonly']['alt']);
+ if ( isset($_POST['insertonly']['align']) ) {
+ $align = attribute_escape($_POST['insertonly']['align']);
+ $class = " class='align$align'";
+ }
+ $html = "<img src='$src' alt='$alt'$class />";
+ return media_send_to_editor($html);
+ }
+
+ if ( !empty($_POST) ) {
+ $return = media_upload_form_handler();
+
+ if ( is_string($return) )
+ return $return;
+ if ( is_array($return) )
+ $errors = $return;
+ }
+
+ return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
+}
+
+function media_upload_audio() {
+ if ( !empty($_FILES) ) {
+ // Upload File button was clicked
+ $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+ unset($_FILES);
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ $id = false;
+ }
+ }
+
+ if ( !empty($_POST['insertonlybutton']) ) {
+ $href = $_POST['insertonly']['href'];
+ if ( !strpos($href, '://') )
+ $href = "http://$href";
+ $title = attribute_escape($_POST['insertonly']['title']);
+ $html = "<a href='$href' >$title</a>";
+ return media_send_to_editor($html);
+ }
+
+ if ( !empty($_POST) ) {
+ $return = media_upload_form_handler();
+
+ if ( is_string($return) )
+ return $return;
+ if ( is_array($return) )
+ $errors = $return;
+ }
+
+ return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
+}
+
+function media_upload_video() {
+ if ( !empty($_FILES) ) {
+ // Upload File button was clicked
+ $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+ unset($_FILES);
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ $id = false;
+ }
+ }
+
+ if ( !empty($_POST['insertonlybutton']) ) {
+ $href = $_POST['insertonly']['href'];
+ if ( !strpos($href, '://') )
+ $href = "http://$href";
+ $title = attribute_escape($_POST['insertonly']['title']);
+ $html = "<a href='$href' >$title</a>";
+ return media_send_to_editor($html);
+ }
+
+ if ( !empty($_POST) ) {
+ $return = media_upload_form_handler();
+
+ if ( is_string($return) )
+ return $return;
+ if ( is_array($return) )
+ $errors = $return;
+ }
+
+ return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
+}
+
+function media_upload_file() {
+ if ( !empty($_FILES) ) {
+ // Upload File button was clicked
+ $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+ unset($_FILES);
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ $id = false;
+ }
+ }
+
+ if ( !empty($_POST['insertonlybutton']) ) {
+ $href = $_POST['insertonly']['href'];
+ if ( !strpos($href, '://') )
+ $href = "http://$href";
+ $title = attribute_escape($_POST['insertonly']['title']);
+ $html = "<a href='$href' >$title</a>";
+ return media_send_to_editor($html);
+ }
+
+ if ( !empty($_POST) ) {
+ $return = media_upload_form_handler();
+
+ if ( is_string($return) )
+ return $return;
+ if ( is_array($return) )
+ $errors = $return;
+ }
+
+ return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
+}
+
+function media_upload_gallery() {
+ if ( !empty($_POST) ) {
+ $return = media_upload_form_handler();
+
+ if ( is_string($return) )
+ return $return;
+ if ( is_array($return) )
+ $errors = $return;
+ }
+
+ return wp_iframe( 'media_upload_gallery_form', $errors );
+}
+
+function media_upload_library() {
+ if ( !empty($_POST) ) {
+ $return = media_upload_form_handler();
+
+ if ( is_string($return) )
+ return $return;
+ if ( is_array($return) )
+ $errors = $return;
+ }
+
+ return wp_iframe( 'media_upload_library_form', $errors );
+}
+
+function get_attachment_taxonomies($attachment) {
+ if ( is_int( $attachment ) )
+ $attachment = get_post($attachment);
+ else if ( is_array($attachment) )
+ $attachment = (object) $attachment;
+
+ if ( ! is_object($attachment) )
+ return array();
+
+ $filename = basename($attachment->guid);
+
+ $objects = array('attachment');
+
+ if ( false !== strpos($filename, '.') )
+ $objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
+ if ( !empty($attachment->post_mime_type) ) {
+ $objects[] = 'attachment:' . $attachment->post_mime_type;
+ if ( false !== strpos($attachment->post_mime_type, '/') )
+ foreach ( explode('/', $attachment->post_mime_type) as $token )
+ if ( !empty($token) )
+ $objects[] = "attachment:$token";
+ }
+
+ $taxonomies = array();
+ foreach ( $objects as $object )
+ if ( $taxes = get_object_taxonomies($object) )
+ $taxonomies = array_merge($taxonomies, $taxes);
+
+ return array_unique($taxonomies);
+}
+
+function image_attachment_fields_to_edit($form_fields, $post) {
+ if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
+ $form_fields['post_title']['required'] = true;
+ $form_fields['post_excerpt']['label'] = __('Description');
+ $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"');
+
+ $form_fields['post_content']['label'] = __('Long Description');
+
+ $thumb = wp_get_attachment_thumb_url($post->ID);
+
+ $form_fields['align'] = array(
+ 'label' => __('Alignment'),
+ 'input' => 'html',
+ 'html' => "
+ <input type='radio' name='attachments[$post->ID][align]' id='image-align-none-$post->ID' value='none' />
+ <label for='image-align-none-$post->ID' class='align image-align-none-label'>" . __('None') . "</label>
+ <input type='radio' name='attachments[$post->ID][align]' id='image-align-left-$post->ID' value='left' />
+ <label for='image-align-left-$post->ID' class='align image-align-left-label'>" . __('Left') . "</label>
+ <input type='radio' name='attachments[$post->ID][align]' id='image-align-center-$post->ID' value='center' />
+ <label for='image-align-center-$post->ID' class='align image-align-center-label'>" . __('Center') . "</label>
+ <input type='radio' name='attachments[$post->ID][align]' id='image-align-right-$post->ID' value='right' />
+ <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n",
+ );
+ $form_fields['image-size'] = array(
+ 'label' => __('Size'),
+ 'input' => 'html',
+ 'html' => "
+ " . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumbnail' />
+ <label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label>
+ " : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' />
+ <label for='image-size-medium-$post->ID'>" . __('Medium') . "</label>
+ <input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' />
+ <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>",
+ );
+ }
+ return $form_fields;
+}
+
+add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2);
+
+function media_single_attachment_fields_to_edit( $form_fields, $post ) {
+ unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
+ return $form_fields;
+}
+
+function image_attachment_fields_to_save($post, $attachment) {
+ if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
+ if ( strlen(trim($post['post_title'])) == 0 ) {
+ $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));
+ $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');
+ }
+ }
+
+ return $post;
+}
+
+add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
+
+function image_media_send_to_editor($html, $attachment_id, $attachment) {
+ $post =& get_post($attachment_id);
+ if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
+ $url = $attachment['url'];
+
+ if ( isset($attachment['align']) )
+ $align = $attachment['align'];
+ else
+ $align = 'none';
+
+ if ( !empty($attachment['image-size']) )
+ $size = $attachment['image-size'];
+ else
+ $size = 'medium';
+
+ return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size);
+ }
+
+ return $html;
+}
+
+add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
+
+function get_attachment_fields_to_edit($post, $errors = null) {
+ if ( is_int($post) )
+ $post =& get_post($post);
+ if ( is_array($post) )
+ $post = (object) $post;
+
+ $edit_post = sanitize_post($post, 'edit');
+ $file = wp_get_attachment_url($post->ID);
+ $link = get_attachment_link($post->ID);
+
+ $form_fields = array(
+ 'post_title' => array(
+ 'label' => __('Title'),
+ 'value' => $edit_post->post_title,
+ ),
+ 'post_excerpt' => array(
+ 'label' => __('Description'),
+ 'value' => $edit_post->post_excerpt,
+ ),
+ 'post_content' => array(
+ 'label' => __('Long description'),
+ 'value' => $edit_post->post_content,
+ 'input' => 'textarea',
+ ),
+ 'url' => array(
+ 'label' => __('Link URL'),
+ 'input' => 'html',
+ 'html' => "
+ <input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($file) . "' /><br />
+ <button type='button' class='button url-$post->ID' value=''>" . __('None') . "</button>
+ <button type='button' class='button url-$post->ID' value='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
+ <button type='button' class='button url-$post->ID' value='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
+ <script type='text/javascript'>
+ jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(this.value);});
+ </script>\n",
+ 'helps' => __('Enter a link URL or click above for presets.'),
+ ),
+ );
+
+ foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
+ $t = (array) get_taxonomy($taxonomy);
+ if ( empty($t['label']) )
+ $t['label'] = $taxonomy;
+ if ( empty($t['args']) )
+ $t['args'] = array();
+
+ $terms = get_object_term_cache($post->ID, $taxonomy);
+ if ( empty($terms) )
+ $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
+
+ $values = array();
+
+ foreach ( $terms as $term )
+ $values[] = $term->name;
+ $t['value'] = join(', ', $values);
+
+ $form_fields[$taxonomy] = $t;
+ }
+
+ // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
+ // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
+ $form_fields = array_merge_recursive($form_fields, (array) $errors);
+
+ $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
+
+ return $form_fields;
+}
+
+function get_media_items( $post_id, $errors ) {
+ if ( $post_id && $post = get_post($post_id) ) {
+ if ( $post->post_type == 'attachment' )
+ $attachments = array($post->ID => $post);
+ else
+ $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC");
+ } else {
+ if ( is_array($GLOBALS['wp_the_query']->posts) )
+ foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
+ $attachments[$attachment->ID] = $attachment;
+ }
+
+ if ( empty($attachments) )
+ return '';
+
+ foreach ( $attachments as $id => $attachment )
+ if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
+ $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div id='media-upload-error-$id'></div><div class='filename'></div><div class='progress'><div class='bar'></div></div>$item<div class='progress clickmask'></div>\n</div>";
+
+ return $output;
+}
+
+function get_media_item( $attachment_id, $args = null ) {
+ $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true );
+ $args = wp_parse_args( $args, $default_args );
+ extract( $args, EXTR_SKIP );
+
+ global $post_mime_types;
+ if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
+ $thumb_url = $thumb_url[0];
+ else
+ return false;
+
+ $title_label = __('Title');
+ $description_label = __('Description');
+ $tags_label = __('Tags');
+
+ $toggle_on = __('Show');
+ $toggle_off = __('Hide');
+
+ $post = get_post($attachment_id);
+
+ $filename = basename($post->guid);
+ $title = attribute_escape($post->post_title);
+ $description = attribute_escape($post->post_content);
+ if ( $_tags = get_the_tags($attachment_id) ) {
+ foreach ( $_tags as $tag )
+ $tags[] = $tag->name;
+ $tags = attribute_escape(join(', ', $tags));
+ }
+
+ if ( isset($post_mime_types) ) {
+ $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
+ $type = array_shift($keys);
+ $type = "<input type='hidden' id='type-of-$attachment_id' value='$type' />";
+ }
+
+ $form_fields = get_attachment_fields_to_edit($post, $errors);
+
+ if ( $toggle ) {
+ $class = empty($errors) ? 'startclosed' : 'startopen';
+ $toggle_links = "
+ <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
+ <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
+ } else {
+ $class = 'form-table';
+ $toggle_links = '';
+ }
+
+ $item = "
+ $type
+ $toggle_links
+ <div class='filename new'>$filename</div>
+ <table class='slidetoggle describe $class'>
+ <tbody class='media-item-info'>
+ <tr>
+ <td class='A1B1' rowspan='4'><img class='thumbnail' src='$thumb_url' alt='' /></td>
+ <td>$filename</td>
+ </tr>
+ <td>$post->post_mime_type</td></tr>
+ <tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr>
+ <tr><td>" . apply_filters('media_meta', '', $post) . "</tr></td>
+ </tbody>
+ <tbody>\n";
+
+ $defaults = array(
+ 'input' => 'text',
+ 'required' => false,
+ 'value' => '',
+ 'extra_rows' => array(),
+ );
+
+ $delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
+ if ( $send )
+ $send = "<button type='submit' class='button' value='1' name='send[$attachment_id]'>" . __('Insert into Post') . '</button>';
+ if ( $delete )
+ $delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>";
+ if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
+ $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete</td></tr>\n");
+
+ $hidden_fields = array();
+
+ foreach ( $form_fields as $id => $field ) {
+ if ( $id{0} == '_' )
+ continue;
+
+ if ( !empty($field['tr']) ) {
+ $item .= $field['tr'];
+ continue;
+ }
+
+ $field = array_merge($defaults, $field);
+ $name = "attachments[$attachment_id][$id]";
+
+ if ( $field['input'] == 'hidden' ) {
+ $hidden_fields[$name] = $field['value'];
+ continue;
+ }
+
+ $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
+ $class = $id;
+ $class .= $field['required'] ? ' form-required' : '';
+
+ $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
+ if ( !empty($field[$field['input']]) )
+ $item .= $field[$field['input']];
+ elseif ( $field['input'] == 'textarea' ) {
+ $item .= "<textarea type='text' id='$name' name='$name'>" . wp_specialchars($field['value'], 1) . "</textarea>";
+ } else {
+ $item .= "<input type='text' id='$name' name='$name' value='" . wp_specialchars($field['value'], 1) . "' />";
+ }
+ if ( !empty($field['helps']) )
+ $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
+ $item .= "</td>\n\t\t</tr>\n";
+
+ $extra_rows = array();
+
+ if ( !empty($field['errors']) )
+ foreach ( array_unique((array) $field['errors']) as $error )
+ $extra_rows['error'][] = $error;
+
+ if ( !empty($field['extra_rows']) )
+ foreach ( $field['extra_rows'] as $class => $rows )
+ foreach ( (array) $rows as $html )
+ $extra_rows[$class][] = $html;
+
+ foreach ( $extra_rows as $class => $rows )
+ foreach ( $rows as $html )
+ $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
+ }
+
+ if ( !empty($form_fields['_final']) )
+ $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
+ $item .= "\t</table>\n";
+
+ foreach ( $hidden_fields as $name => $value )
+ $item .= "\t<input type='hidden' name='$name' id='$name' value='" . wp_specialchars($value, 1) . "' />\n";
+
+ return $item;
+}
+
+function media_upload_header() {
+ ?>
+ <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script>
+ <div id="media-upload-header">
+ <?php the_media_upload_tabs(); ?>
+ </div>
+ <?php
+}
+
+function media_upload_form( $errors = null ) {
+ global $type, $tab;
+
+ $flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
+
+ $post_id = intval($_REQUEST['post_id']);
+
+?>
+<input type='hidden' name='post_id' value='<?php echo $post_id; ?>' />
+<div id="media-upload-error">
+<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
+ <?php echo $errors['upload_error']->get_error_message(); ?>
+<?php } ?>
+</div>
+<script type="text/javascript">
+<!--
+jQuery(function($){
+ swfu = new SWFUpload({
+ upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
+ flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>",
+ file_post_name: "async-upload",
+ file_types: "*.*",
+ post_params : {
+ "post_id" : "<?php echo $post_id; ?>",
+ "auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>",
+ "type" : "<?php echo $type; ?>",
+ "tab" : "<?php echo $tab; ?>"
+ },
+ file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
+ swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
+ degraded_element_id : "html-upload-ui", // when swfupload is unavailable
+ swfupload_loaded_handler : uploadLoaded,
+ file_dialog_start_handler : fileDialogStart,
+ file_queued_handler : fileQueued,
+ upload_start_handler : uploadStart,
+ upload_progress_handler : uploadProgress,
+ upload_error_handler : uploadError,
+ upload_success_handler : uploadSuccess,
+ upload_complete_handler : uploadComplete,
+ file_queue_error_handler : fileQueueError,
+ file_dialog_complete_handler : fileDialogComplete,
+
+ debug: false,
+ });
+ $("#flash-browse-button").bind( "click", function(){swfu.selectFiles();});
+});
+//-->
+</script>
+
+
+<div id="flash-upload-ui">
+ <p><input id="flash-browse-button" type="button" value="<?php _e('Choose files to upload'); ?>" class="button" /></p>
+ <p><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
+</div>
+
+<div id="html-upload-ui">
+ <p>
+ <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
+ </p>
+ <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
+ <br style="clear:both" />
+</div>
+<?php
+}
+
+function media_upload_type_form($type = 'file', $errors = null, $id = null) {
+ media_upload_header();
+
+ $post_id = intval($_REQUEST['post_id']);
+
+ $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=$type&tab=type&post_id=$post_id";
+
+ $callback = "type_form_$type";
+?>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form" id="<?php echo $type; ?>-form">
+<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
+<?php wp_nonce_field('media-form'); ?>
+<h3><?php _e('From Computer'); ?></h3>
+<?php media_upload_form( $errors ); ?>
+
+<script type="text/javascript">
+<!--
+jQuery(function($){
+ var preloaded = $(".media-item.preloaded");
+ if ( preloaded.length > 0 ) {
+ preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+ }
+ updateMediaForm();
+});
+-->
+</script>
+<?php if ( $id && !is_wp_error($id) ) : ?>
+<div id="media-items">
+<?php echo get_media_items( $id, $errors ); ?>
+</div>
+<input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" />
+
+<?php elseif ( is_callable($callback) ) : ?>
+
+<div class="media-blank">
+<p style="text-align:center"><?php _e('&mdash; OR &mdash;'); ?></p>
+<h3><?php _e('From URL'); ?></h3>
+</div>
+
+<div id="media-items">
+<div class="media-item media-blank">
+<?php echo call_user_func($callback); ?>
+</div>
+</div>
+<input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" />
+<?php
+ endif;
+}
+
+function media_upload_gallery_form($errors) {
+ media_upload_header();
+
+ $post_id = intval($_REQUEST['post_id']);
+
+ $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id";
+
+?>
+
+<script type="text/javascript">
+<!--
+jQuery(function($){
+ var preloaded = $(".media-item.preloaded");
+ if ( preloaded.length > 0 ) {
+ preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+ updateMediaForm();
+ }
+});
+-->
+</script>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form" id="gallery-form">
+<?php wp_nonce_field('media-form'); ?>
+<?php //media_upload_form( $errors ); ?>
+
+<div id="media-items">
+<?php echo get_media_items($post_id, $errors); ?>
+</div>
+<input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" />
+<input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php _e('Insert gallery into post'); ?>" />
+<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
+<input type="hidden" name="type" value="<?php echo $GLOBALS['type']; ?>" />
+<input type="hidden" name="tab" value="<?php echo $GLOBALS['tab']; ?>" />
+</form>
+<?php
+}
+
+function media_upload_library_form($errors) {
+ global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
+
+ media_upload_header();
+
+ $post_id = intval($_REQUEST['post_id']);
+
+ $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id";
+
+ $_GET['paged'] = intval($_GET['paged']);
+ if ( $_GET['paged'] < 1 )
+ $_GET['paged'] = 1;
+ $start = ( $_GET['paged'] - 1 ) * 10;
+ if ( $start < 1 )
+ $start = 0;
+ add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) );
+
+ list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
+
+?>
+
+<form id="filter" action="" method="get">
+<input type="hidden" name="type" value="<?php echo $type; ?>" />
+<input type="hidden" name="tab" value="<?php echo $tab; ?>" />
+<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
+<input type="hidden" name="post_mime_type" value="<?php echo wp_specialchars($_GET['post_mime_type'], true); ?>" />
+
+<div id="search-filter">
+ <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
+ <input type="submit" value="<?php _e( 'Search Media' ); ?>" class="button" />
+</div>
+
+<p>
+<ul class="subsubsub">
+<?php
+$type_links = array();
+$_num_posts = (array) wp_count_attachments();
+$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
+foreach ( $matches as $_type => $reals )
+ foreach ( $reals as $real )
+ $num_posts[$_type] += $_num_posts[$real];
+$class = empty($_GET['post_mime_type']) ? ' class="current"' : '';
+$type_links[] = "<li><a href='" . remove_query_arg(array('post_mime_type', 'paged', 'm')) . "'$class>".__('All Types')."</a>";
+foreach ( $post_mime_types as $mime_type => $label ) {
+ $class = '';
+
+ if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
+ continue;
+
+ if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
+ $class = ' class="current"';
+
+ $type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf($label[2], "<span id='$mime_type-counter'>{$num_posts[$mime_type]}</span>") . '</a>';
+}
+echo implode(' | </li>', $type_links) . '</li>';
+unset($type_links);
+?>
+</ul>
+</p>
+
+<div class="tablenav">
+
+<?php
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'paged', '%#%' ),
+ 'format' => '',
+ 'total' => ceil($wp_query->found_posts / 10),
+ 'current' => $_GET['paged']
+));
+
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
+<div style="float: left">
+<?php
+
+$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
+
+$arc_result = $wpdb->get_results( $arc_query );
+
+$month_count = count($arc_result);
+
+if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
+<select name='m'>
+<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
+<?php
+foreach ($arc_result as $arc_row) {
+ if ( $arc_row->yyear == 0 )
+ continue;
+ $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
+
+ if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
+ $default = ' selected="selected"';
+ else
+ $default = '';
+
+ echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
+ echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
+ echo "</option>\n";
+}
+?>
+</select>
+<?php } ?>
+
+<input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button-secondary" />
+
+</div>
+
+<br style="clear:both;" />
+</div>
+</form>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form" id="library-form">
+
+<?php wp_nonce_field('media-form'); ?>
+<?php //media_upload_form( $errors ); ?>
+
+<script type="text/javascript">
+<!--
+jQuery(function($){
+ var preloaded = $(".media-item.preloaded");
+ if ( preloaded.length > 0 ) {
+ preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+ updateMediaForm();
+ }
+});
+-->
+</script>
+
+<div id="media-items">
+<?php echo get_media_items(null, $errors); ?>
+</div>
+<input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes'); ?>" />
+<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
+</form>
+<?php
+}
+
+function type_form_image() {
+ return '
+ <table class="describe"><tbody>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[src]">' . __('Image URL') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text"></td>
+ </tr>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[alt]">' . __('Description') . '</label></span>
+ <span class="alignright"><abbr title="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text"></td>
+ </tr>
+ <tr><td></td><td class="help">' . __('Alternate text, e.g. "The Mona Lisa"') . '</td></tr>
+ <tr class="align">
+ <th valign="top" scope="row" class="label"><label for="insertonly[align]">' . __('Alignment') . '</label></th>
+ <td class="field">
+ <input name="insertonly[align]" id="image-align-none-0" value="none" type="radio">
+ <label for="image-align-none-0" class="align image-align-none-label">' . __('None') . '</label>
+ <input name="insertonly[align]" id="image-align-left-0" value="left" type="radio">
+ <label for="image-align-left-0" class="align image-align-left-label">' . __('Left') . '</label>
+ <input name="insertonly[align]" id="image-align-center-0" value="center" type="radio">
+ <label for="image-align-center-0" class="align image-align-center-label">' . __('Center') . '</label>
+ <input name="insertonly[align]" id="image-align-right-0" value="right" type="radio">
+ <label for="image-align-right-0" class="align image-align-right-label">' . __('Right') . '</label>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+ </td>
+ </tr>
+ </tbody></table>
+';
+}
+
+function type_form_audio() {
+ return '
+ <table class="describe"><tbody>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+ </tr>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+ </tr>
+ <tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+ </td>
+ </tr>
+ </tbody></table>
+';
+}
+
+function type_form_video() {
+ return '
+ <table class="describe"><tbody>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+ </tr>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+ </tr>
+ <tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+ </td>
+ </tr>
+ </tbody></table>
+';
+}
+
+function type_form_file() {
+ return '
+ <table class="describe"><tbody>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+ </tr>
+ <tr>
+ <th valign="top" scope="row" class="label">
+ <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
+ <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+ </th>
+ <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+ </tr>
+ <tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+ </td>
+ </tr>
+ </tbody></table>
+';
+}
+
+add_filter('async_upload_image', 'get_media_item', 10, 2);
+add_filter('async_upload_audio', 'get_media_item', 10, 2);
+add_filter('async_upload_video', 'get_media_item', 10, 2);
+add_filter('async_upload_file', 'get_media_item', 10, 2);
+
+add_action('media_upload_image', 'media_upload_image');
+add_action('media_upload_audio', 'media_upload_audio');
+add_action('media_upload_video', 'media_upload_video');
+add_action('media_upload_file', 'media_upload_file');
+add_action('admin_head_media_upload_type_form', 'media_admin_css');
+
+add_filter('media_upload_gallery', 'media_upload_gallery');
+add_action('admin_head_media_upload_gallery_form', 'media_admin_css');
+
+add_filter('media_upload_library', 'media_upload_library');
+add_action('admin_head_media_upload_library_form', 'media_admin_css');
+
+
+// Any 'attachment' taxonomy will be included in the description input form for the multi uploader
+// Example:
+/*
+register_taxonomy(
+ 'image_people',
+ 'attachment:image',
+ array(
+ 'label' => __('People'),
+ 'template' => __('People: %l'),
+ 'helps' => __('Left to right, top to bottom.'),
+ 'sort' => true,
+ 'args' => array(
+ 'orderby' => 'term_order'
+ )
+ )
+);
+*/
+/*
+register_taxonomy('movie_director', 'attachment:video', array('label'=>__('Directors'), 'template'=>__('Directed by %l.')));
+register_taxonomy('movie_producer', 'attachment:video', array('label'=>__('Producers'), 'template'=>__('Produced by %l.')));
+register_taxonomy('movie_screenwriter', 'attachment:video', array('label'=>__('Screenwriter'), 'template'=>__('Screenplay by %l.')));
+register_taxonomy('movie_actor', 'attachment:video', array('label'=>__('Cast'), 'template'=>array(__('Cast: %l.')));
+register_taxonomy('movie_crew', 'attachment:video', array('label'=>__('Crew'), 'template'=>array(__('Crew: %l.')));
+*/
+
+?>
diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php
new file mode 100644
index 0000000..4523b24
--- /dev/null
+++ b/wp-admin/includes/widgets.php
@@ -0,0 +1,269 @@
+<?php
+
+// $_search is unsanitized
+function wp_list_widgets( $show = 'all', $_search = false ) {
+ global $wp_registered_widgets, $sidebars_widgets;
+ if ( $_search ) {
+ // sanitize
+ $search = preg_replace( '/[^\w\s]/', '', $_search );
+ // array of terms
+ $search_terms = preg_split( '/[\s]/', $search, -1, PREG_SPLIT_NO_EMPTY );
+ } else {
+ $search_terms = array();
+ }
+
+ if ( !in_array( $show, array( 'all', 'unused', 'used' ) ) )
+ $show = 'all';
+?>
+
+ <ul id='widget-list'>
+ <?php
+ $no_widgets_shown = true;
+ $already_shown = array();
+ foreach ( $wp_registered_widgets as $name => $widget ) :
+ if ( in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
+ continue;
+
+ if ( $search_terms ) {
+ $hit = false;
+ // Simple case-insensitive search. Boolean OR.
+ $search_text = preg_replace( '/[^\w]/', '', $widget['name'] );
+ if ( isset($widget['description']) )
+ $search_text .= preg_replace( '/[^\w]/', '', $widget['description'] );
+
+ foreach ( $search_terms as $search_term ) {
+ if ( stristr( $search_text, $search_term ) ) {
+ $hit = true;
+ break;
+ }
+ }
+ if ( !$hit )
+ continue;
+ }
+
+ $sidebar = is_active_widget( $widget['callback'], $widget['id'] );
+
+ if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
+ continue;
+
+ ob_start();
+ $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' ) ) );
+ $sidebar_args = call_user_func_array( 'wp_widget_control', $args );
+ $widget_control_template = ob_get_contents();
+ ob_end_clean();
+
+ $is_multi = false !== strpos( $widget_control_template, '%i%' );
+ if ( !$sidebar || $is_multi ) {
+ if ( $is_multi )
+ $already_shown[] = $widget['callback']; // it's a multi-widget. We only need to show it in the list once.
+ $action = 'add';
+ $add_url = wp_nonce_url( add_query_arg( array(
+ 'sidebar' => $sidebar,
+ 'add' => $widget['id'],
+ 'key' => false,
+ 'edit' => false
+ ) ), "add-widget_$widget[id]" );
+ } else {
+ $action = 'edit';
+ $edit_url = clean_url( add_query_arg( array(
+ 'sidebar' => $sidebar,
+ 'edit' => $widget['id'],
+ 'key' => array_search( $widget['id'], $sidebars_widgets[$sidebar] ),
+ ) ) );
+
+ $widget_control_template = '<textarea rows="1" cols="1">' . htmlspecialchars( $widget_control_template ) . '</textarea>';
+ }
+
+ $widget_control_template = $sidebar_args['before_widget'] . $widget_control_template . $sidebar_args['after_widget'];
+
+ $no_widgets_shown = false;
+
+ ?>
+
+ <li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
+ <h4 class="widget-title widget-draggable">
+
+ <?php echo wp_specialchars( $widget['name'] ); ?>
+
+ <?php if ( 'add' == $action ) : ?>
+
+ <a class="widget-action widget-control-add" href="<?php echo $add_url; ?>"><?php _e( 'Add' ); ?></a>
+
+ <?php elseif ( 'edit' == $action ) :
+ // We echo a hidden edit link for the sake of the JS. Edit links are shown (needlessly?) after a widget is added.
+ ?>
+
+ <a class="widget-action widget-control-edit" href="<?php echo $edit_url; ?>" style="display: none;"><?php _e( 'Edit' ); ?></a>
+
+ <?php endif; ?>
+
+ </h4>
+
+
+ <ul id="widget-control-info-<?php echo $widget['id']; ?>" class="widget-control-info">
+
+ <?php echo $widget_control_template; ?>
+
+ </ul>
+
+ <?php if ( 'add' == $action ) : ?>
+ <?php endif; ?>
+
+ <div class="widget-description">
+ <?php echo ( $widget_description = wp_widget_description( $widget['id'] ) ) ? $widget_description : '&nbsp;'; ?>
+ </div>
+
+ <br class="clear" />
+
+ </li>
+
+ <?php endforeach; if ( $no_widgets_shown ) : ?>
+
+ <li><?php _e( 'No matching widgets' ); ?></li>
+
+ <?php endif; ?>
+
+ </ul>
+<?php
+}
+
+
+
+function wp_list_widget_controls( $sidebar ) {
+ add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
+?>
+
+ <ul class="widget-control-list">
+
+ <?php if ( !dynamic_sidebar( $sidebar ) ) echo "<li />"; ?>
+
+ </ul>
+
+<?php
+}
+
+
+function wp_list_widget_controls_dynamic_sidebar( $params ) {
+ global $wp_registered_widgets;
+ static $i = 0;
+ $i++;
+
+ $widget_id = $params[0]['widget_id'];
+
+ $params[0]['before_widget'] = "<li id='widget-list-control-item-$i-$widget_id' class='widget-list-control-item widget-sortable'>\n";
+ $params[0]['after_widget'] = "</li>";
+ $params[0]['before_title'] = "%BEG_OF_TITLE%";
+ $params[0]['after_title'] = "%END_OF_TITLE%";
+ if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) {
+ $wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback'];
+ $wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control';
+ }
+ return $params;
+}
+
+/*
+ * Meta widget used to display the control form for a widget. Called from dynamic_sidebar()
+ */
+function wp_widget_control( $sidebar_args ) {
+ global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
+ $widget_id = $sidebar_args['widget_id'];
+ $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
+
+ $control = $wp_registered_widget_controls[$widget_id];
+ $widget = $wp_registered_widgets[$widget_id];
+
+ $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : 'no-key'; // position of widget in sidebar
+
+ $edit = $edit_widget > 0 && $key && $edit_widget == $key; // (bool) are we currently editing this widget
+
+ $id_format = $widget['id'];
+ // We aren't showing a widget control, we're outputing a template for a mult-widget control
+ if ( 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
+ // number == -1 implies a template where id numbers are replaced by a generic '%i%'
+ $control['params'][0]['number'] = -1;
+ // if given, id_base means widget id's should be constructed like {$id_base}-{$id_number}
+ if ( isset($control['id_base']) )
+ $id_format = $control['id_base'] . '-%i%';
+ }
+
+ $widget_title = '';
+ // We grab the normal widget output to find the widget's title
+ if ( is_callable( $widget['_callback'] ) ) {
+ ob_start();
+ $args = func_get_args();
+ call_user_func_array( $widget['_callback'], $args );
+ $widget_title = ob_get_clean();
+ $widget_title = wp_widget_control_ob_filter( $widget_title );
+ }
+ $wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
+ unset($wp_registered_widgets[$widget_id]['_callback']);
+
+ if ( $widget_title )
+ $widget_title = sprintf( _c('%1$s: %2$s|widget_admin_title' ), $sidebar_args['widget_name'], $widget_title );
+ else
+ $widget_title = wp_specialchars( strip_tags( $sidebar_args['widget_name'] ) );
+
+
+ if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
+ echo $sidebar_args['before_widget'];
+?>
+ <h4 class="widget-title"><?php echo $widget_title ?>
+
+ <?php if ( $edit ) : ?>
+
+ <a class="widget-action widget-control-edit" href="<?php echo remove_query_arg( array( 'edit', 'key' ) ); ?>"><?php _e('Cancel'); ?></a>
+
+ <?php else : ?>
+
+ <a class="widget-action widget-control-edit" href="<?php echo clean_url( add_query_arg( array( 'edit' => $id_format, 'key' => $key ) ) ); ?>"><?php _e('Edit'); ?></a>
+
+ <?php endif; ?>
+
+ </h4>
+
+ <div class="widget-control"<?php if ( $edit ) echo ' style="display: block;"'; ?>>
+
+ <?php
+ if ( $control )
+ call_user_func_array( $control['callback'], $control['params'] );
+ else
+ echo '<p>' . __('There are no options for this widget.') . '</p>';
+ ?>
+
+ <input type="hidden" name="widget-id[]" value="<?php echo $id_format; ?>" />
+ <input type="hidden" class="widget-width" value="<?php echo $control['width']; ?>" />
+
+ <div class="widget-control-actions">
+
+ <?php if ( $control ) : ?>
+
+ <a class="widget-action widget-control-save wp-no-js-hidden edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Change'); ?></a>
+
+ <?php endif; ?>
+
+ <a class="widget-action widget-control-remove delete alignright" href="<?php echo clean_url( add_query_arg( array( 'remove' => $id_format, 'key' => $key ), wp_nonce_url( null, "remove-widget_$widget[id]" ) ) ); ?>"><?php _e('Remove'); ?></a>
+ <br class="clear" />
+ </div>
+ </div>
+<?php
+ if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
+ echo $sidebar_args['after_widget'];
+ return $sidebar_args;
+}
+
+function wp_widget_control_ob_filter( $string ) {
+ if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )
+ return '';
+ if ( false === $end = strpos( $string, '%END_OF_TITLE%' ) )
+ return '';
+ $string = substr( $string, $beg + 14 , $end - $beg - 14);
+ return wp_specialchars( strip_tags( $string ) );
+}
+
+function widget_css() {
+ wp_admin_css( 'css/widgets' );
+}
+
+add_action( 'admin_head', 'widget_css' );
+
+?>
diff --git a/wp-admin/js/comment.js b/wp-admin/js/comment.js
new file mode 100644
index 0000000..bde9b97
--- /dev/null
+++ b/wp-admin/js/comment.js
@@ -0,0 +1,12 @@
+addLoadEvent( function() {
+ add_postbox_toggles('comment');
+
+ jQuery('.edit-timestamp').click(function () {
+ if (jQuery('#timestampdiv').is(":hidden")) {
+ jQuery('#timestampdiv').slideDown("normal");
+ } else {
+ jQuery('#timestampdiv').hide();
+ }
+ return false;
+ });
+}); \ No newline at end of file
diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js
new file mode 100644
index 0000000..9f05e55
--- /dev/null
+++ b/wp-admin/js/common.js
@@ -0,0 +1,12 @@
+addLoadEvent( function() {
+ // pulse
+ jQuery('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
+
+ // Reveal
+ jQuery('.wp-no-js-hidden').removeClass( 'wp-no-js-hidden' );
+
+ // Basic form validation
+ if ( ( 'undefined' != typeof wpAjax ) && jQuery.isFunction( wpAjax.validateForm ) ) {
+ jQuery('form').submit( function() { return wpAjax.validateForm( jQuery(this) ); } );
+ }
+});
diff --git a/wp-admin/js/dbx-admin-key.js b/wp-admin/js/dbx-admin-key.js
deleted file mode 100644
index 3b3f7af..0000000
--- a/wp-admin/js/dbx-admin-key.js
+++ /dev/null
@@ -1,47 +0,0 @@
-addLoadEvent( function() {var manager = new dbxManager( dbxL10n.manager );} );
-
-addLoadEvent( function()
-{
- //create new docking boxes group
- var meta = new dbxGroup(
- 'grabit', // container ID [/-_a-zA-Z0-9/]
- 'vertical', // orientation ['vertical'|'horizontal']
- '10', // drag threshold ['n' pixels]
- 'no', // restrict drag movement to container axis ['yes'|'no']
- '10', // animate re-ordering [frames per transition, or '0' for no effect]
- 'yes', // include open/close toggle buttons ['yes'|'no']
- 'closed', // default state ['open'|'closed']
- dbxL10n.open, // word for "open", as in "open this box"
- dbxL10n.close, // word for "close", as in "close this box"
- dbxL10n.moveMouse, // sentence for "move this box" by mouse
- dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse
- dbxL10n.moveKey, // sentence for "move this box" by keyboard
- dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard
- '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
- );
-
- // Boxes are closed by default. Open the Category box if the cookie isn't already set.
- var catdiv = document.getElementById('categorydiv');
- if ( catdiv ) {
- var button = catdiv.getElementsByTagName('A')[0];
- if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )
- meta.toggleBoxState(button, true);
- }
-
- var advanced = new dbxGroup(
- 'advancedstuff',
- 'vertical',
- '10',
- 'yes', // restrict drag movement to container axis ['yes'|'no']
- '10',
- 'yes',
- 'closed',
- dbxL10n.open,
- dbxL10n.close,
- dbxL10n.moveMouse,
- dbxL10n.toggleMouse,
- dbxL10n.moveKey,
- dbxL10n.toggleKey,
- '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
- );
-});
diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js
new file mode 100644
index 0000000..a5500ec
--- /dev/null
+++ b/wp-admin/js/editor.js
@@ -0,0 +1,153 @@
+wpEditorInit = function() {
+ // Activate tinyMCE if it's the user's default editor
+ if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
+ document.getElementById('editorcontainer').style.padding = '0px';
+ tinyMCE.execCommand("mceAddControl", false, "content");
+ } else {
+ var H;
+ if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
+ document.getElementById('content').style.height = H.ch - 30 + 'px';
+ }
+};
+
+switchEditors = {
+
+ saveCallback : function(el, content, body) {
+
+ document.getElementById(el).style.color = '#fff';
+ if ( tinyMCE.activeEditor.isHidden() )
+ content = document.getElementById(el).value;
+ else
+ content = this.pre_wpautop(content);
+
+ return content;
+ },
+
+ pre_wpautop : function(content) {
+ // We have a TON of cleanup to do.
+
+ // Remove anonymous, empty paragraphs.
+ content = content.replace(new RegExp('<p>(\\s|&nbsp;|<br />)*</p>', 'mg'), '');
+
+ // Mark </p> if it has any attributes.
+ content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
+
+ // Get it ready for wpautop.
+ content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
+ content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
+ content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
+ content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
+
+ // Fix some block element newline issues
+ var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
+ content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
+ content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
+ content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
+
+ if ( content.indexOf('<object') != -1 ) {
+ content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed
+ content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>');
+ }
+
+ // Unmark special paragraph closing tags
+ content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
+ content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
+
+ // Trim trailing whitespace
+ content = content.replace(new RegExp('\\s*$', ''), '');
+
+ // Hope.
+ return content;
+ },
+
+ go : function(id) {
+ var ed = tinyMCE.get(id);
+ var qt = document.getElementById('quicktags');
+ var H = document.getElementById('edButtonHTML');
+ var P = document.getElementById('edButtonPreview');
+ var ta = document.getElementById(id);
+ var ec = document.getElementById('editorcontainer');
+
+ if ( ! ed || ed.isHidden() ) {
+ ta.style.color = '#fff';
+
+ this.edToggle(P, H);
+ edCloseAllTags(); // :-(
+
+ qt.style.display = 'none';
+ ec.style.padding = '0px';
+ ta.style.padding = '0px';
+
+ ta.value = this.wpautop(ta.value);
+
+ if ( ed ) ed.show();
+ else tinyMCE.execCommand("mceAddControl", false, id);
+
+ this.wpSetDefaultEditor('tinymce');
+ } else {
+ this.edToggle(H, P);
+ ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
+
+ ed.hide();
+ qt.style.display = 'block';
+
+ if ( tinymce.isIE6 ) {
+ ta.style.width = '98%';
+ ec.style.padding = '0px';
+ ta.style.padding = '6px';
+ } else {
+ ta.style.width = '100%';
+ ec.style.padding = '6px';
+ }
+
+ ta.style.color = '';
+ this.wpSetDefaultEditor('html');
+ }
+ },
+
+ edToggle : function(A, B) {
+ A.className = 'active';
+ B.className = '';
+
+ B.onclick = A.onclick;
+ A.onclick = null;
+ },
+
+ wpSetDefaultEditor : function(editor) {
+ try {
+ editor = escape( editor.toString() );
+ } catch(err) {
+ editor = 'tinymce';
+ }
+
+ var userID = document.getElementById('user-id');
+ var date = new Date();
+ date.setTime(date.getTime()+(10*365*24*60*60*1000));
+ document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
+ },
+
+ wpautop : function(pee) {
+ var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';
+
+ pee = pee + "\n\n";
+ pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
+ pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
+ pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
+ pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
+ pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
+ pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
+ pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
+ pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
+ pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
+ pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
+ pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>');
+ pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
+ pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
+ pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
+ pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
+ pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
+ pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
+ //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm...
+ return pee;
+ }
+}
diff --git a/wp-admin/js/forms.js b/wp-admin/js/forms.js
new file mode 100644
index 0000000..21a62f4
--- /dev/null
+++ b/wp-admin/js/forms.js
@@ -0,0 +1,31 @@
+function checkAll(form) {
+ for (i = 0, n = form.elements.length; i < n; i++) {
+ if(form.elements[i].type == "checkbox" && !(form.elements[i].hasAttribute('onclick'))) {
+ if(form.elements[i].checked == true)
+ form.elements[i].checked = false;
+ else
+ form.elements[i].checked = true;
+ }
+ }
+}
+
+function getNumChecked(form) {
+ var num = 0;
+ for (i = 0, n = form.elements.length; i < n; i++) {
+ if (form.elements[i].type == "checkbox") {
+ if (form.elements[i].checked == true)
+ num++;
+ }
+ }
+ return num;
+}
+
+function checkAllUsers(role) {
+ var checkboxs = document.getElementsByTagName('input');
+ for(var i = 0, inp; inp = checkboxs[i]; i++)
+ if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
+ if(inp.checked == false)
+ inp.checked = true;
+ else
+ inp.checked = false;
+} \ No newline at end of file
diff --git a/wp-admin/js/link-cat.js b/wp-admin/js/link-cat.js
deleted file mode 100644
index a0775ce..0000000
--- a/wp-admin/js/link-cat.js
+++ /dev/null
@@ -1,10 +0,0 @@
-addLoadEvent(function(){linkcatList=new listMan('linkcategorychecklist');linkcatList.ajaxRespEl='jaxcat';linkcatList.topAdder=1;linkcatList.alt=0;linkcatList.showLink=0;});
-addLoadEvent(newLinkCatAddIn);
-function newLinkCatAddIn() {
- var jaxcat = $('jaxcat');
- if ( !jaxcat )
- return false;
- Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + linkcatL10n.add + '"/><input type="hidden"/><span id="howto">' + linkcatL10n.how + '</span></span>');
- $('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); };
- $('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); };
-}
diff --git a/wp-admin/js/link.js b/wp-admin/js/link.js
new file mode 100644
index 0000000..9f5a28d
--- /dev/null
+++ b/wp-admin/js/link.js
@@ -0,0 +1,48 @@
+addLoadEvent( function() {
+ jQuery('#link_name').focus();
+ // postboxes
+ add_postbox_toggles('link');
+
+ // category tabs
+ var categoryTabs = jQuery('#category-tabs').tabs();
+
+ // Ajax Cat
+ var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
+ jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
+ var noSyncChecks = false; // prophylactic. necessary?
+ var syncChecks = function() {
+ if ( noSyncChecks )
+ return;
+ noSyncChecks = true;
+ var th = jQuery(this);
+ var c = th.is(':checked');
+ var id = th.val().toString();
+ jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+ noSyncChecks = false;
+ };
+ var catAddAfter = function( r, s ) {
+ jQuery(s.what + ' response_data', r).each( function() {
+ var t = jQuery(jQuery(this).text());
+ t.find( 'label' ).each( function() {
+ var th = jQuery(this);
+ var val = th.find('input').val();
+ var id = th.find('input')[0].id
+ jQuery('#' + id).change( syncChecks );
+ var name = jQuery.trim( th.text() );
+ var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name );
+ } );
+ } );
+ };
+ jQuery('#categorychecklist').wpList( {
+ alt: '',
+ what: 'link-category',
+ response: 'category-ajax-response',
+ addAfter: catAddAfter
+ } );
+ jQuery('#category-add-toggle').click( function() {
+ jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
+ categoryTabs.tabsClick( 1 );
+ return false;
+ } );
+ jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
+});
diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js
new file mode 100644
index 0000000..b8c615d
--- /dev/null
+++ b/wp-admin/js/media-upload.js
@@ -0,0 +1,12 @@
+// send html to the post editor
+function send_to_editor(h) {
+ var win = window.opener ? window.opener : window.dialogArguments;
+ if ( !win )
+ win = top;
+ tinyMCE = win.tinyMCE;
+ if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) {
+ tinyMCE.selectedInstance.getWin().focus();
+ tinyMCE.execCommand('mceInsertContent', false, h);
+ } else
+ win.edInsertContent(win.edCanvas, h);
+} \ No newline at end of file
diff --git a/wp-admin/js/page.js b/wp-admin/js/page.js
new file mode 100644
index 0000000..02fd708
--- /dev/null
+++ b/wp-admin/js/page.js
@@ -0,0 +1,16 @@
+addLoadEvent( function() {
+ add_postbox_toggles('page');
+ make_slugedit_clickable();
+
+ // hide advanced slug field
+ jQuery('#pageslugdiv').hide();
+
+ jQuery('.edit-timestamp').click(function () {
+ if (jQuery('#timestampdiv').is(":hidden")) {
+ jQuery('#timestampdiv').slideDown("normal");
+ } else {
+ jQuery('#timestampdiv').hide();
+ }
+ return false;
+ });
+}); \ No newline at end of file
diff --git a/wp-admin/js/password-strength-meter.js b/wp-admin/js/password-strength-meter.js
new file mode 100644
index 0000000..eba43fc
--- /dev/null
+++ b/wp-admin/js/password-strength-meter.js
@@ -0,0 +1,162 @@
+// Password strength meter
+// This jQuery plugin is written by firas kassem [2007.04.05]
+// Firas Kassem phiras.wordpress.com || phiras at gmail {dot} com
+// for more information : http://phiras.wordpress.com/2007/04/08/password-strength-meter-a-jquery-plugin/
+
+var shortPass = 'Too short'
+var badPass = 'Bad'
+var goodPass = 'Good'
+var strongPass = 'Strong'
+
+
+
+function passwordStrength(password,username)
+{
+ score = 0
+
+ //password < 4
+ if (password.length < 4 ) { return shortPass }
+
+ //password == username
+ if (password.toLowerCase()==username.toLowerCase()) return badPass
+
+ //password length
+ score += password.length * 4
+ score += ( checkRepetition(1,password).length - password.length ) * 1
+ score += ( checkRepetition(2,password).length - password.length ) * 1
+ score += ( checkRepetition(3,password).length - password.length ) * 1
+ score += ( checkRepetition(4,password).length - password.length ) * 1
+
+ //password has 3 numbers
+ if (password.match(/(.*[0-9].*[0-9].*[0-9])/)) score += 5
+
+ //password has 2 sybols
+ if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) score += 5
+
+ //password has Upper and Lower chars
+ if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) score += 10
+
+ //password has number and chars
+ if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) score += 15
+ //
+ //password has number and symbol
+ if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/)) score += 15
+
+ //password has char and symbol
+ if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/)) score += 15
+
+ //password is just a nubers or chars
+ if (password.match(/^\w+$/) || password.match(/^\d+$/) ) score -= 10
+
+ //verifing 0 < score < 100
+ if ( score < 0 ) score = 0
+ if ( score > 100 ) score = 100
+
+ if (score < 34 ) return badPass
+ if (score < 68 ) return goodPass
+ return strongPass
+}
+
+
+// checkRepetition(1,'aaaaaaabcbc') = 'abcbc'
+// checkRepetition(2,'aaaaaaabcbc') = 'aabc'
+// checkRepetition(2,'aaaaaaabcdbcd') = 'aabcd'
+
+function checkRepetition(pLen,str) {
+ res = ""
+ for ( i=0; i<str.length ; i++ ) {
+ repeated=true
+ for (j=0;j < pLen && (j+i+pLen) < str.length;j++)
+ repeated=repeated && (str.charAt(j+i)==str.charAt(j+i+pLen))
+ if (j<pLen) repeated=false
+ if (repeated) {
+ i+=pLen-1
+ repeated=false
+ }
+ else {
+ res+=str.charAt(i)
+ }
+ }
+ return res
+}
+// Password strength meter
+// This jQuery plugin is written by firas kassem [2007.04.05]
+// Firas Kassem phiras.wordpress.com || phiras at gmail {dot} com
+// for more information : http://phiras.wordpress.com/2007/04/08/password-strength-meter-a-jquery-plugin/
+
+var shortPass = 'Too short'
+var badPass = 'Bad'
+var goodPass = 'Good'
+var strongPass = 'Strong'
+
+
+
+function passwordStrength(password,username)
+{
+ score = 0
+
+ //password < 4
+ if (password.length < 4 ) { return shortPass }
+
+ //password == username
+ if (password.toLowerCase()==username.toLowerCase()) return badPass
+
+ //password length
+ score += password.length * 4
+ score += ( checkRepetition(1,password).length - password.length ) * 1
+ score += ( checkRepetition(2,password).length - password.length ) * 1
+ score += ( checkRepetition(3,password).length - password.length ) * 1
+ score += ( checkRepetition(4,password).length - password.length ) * 1
+
+ //password has 3 numbers
+ if (password.match(/(.*[0-9].*[0-9].*[0-9])/)) score += 5
+
+ //password has 2 sybols
+ if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) score += 5
+
+ //password has Upper and Lower chars
+ if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) score += 10
+
+ //password has number and chars
+ if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) score += 15
+ //
+ //password has number and symbol
+ if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/)) score += 15
+
+ //password has char and symbol
+ if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/)) score += 15
+
+ //password is just a nubers or chars
+ if (password.match(/^\w+$/) || password.match(/^\d+$/) ) score -= 10
+
+ //verifing 0 < score < 100
+ if ( score < 0 ) score = 0
+ if ( score > 100 ) score = 100
+
+ if (score < 34 ) return badPass
+ if (score < 68 ) return goodPass
+ return strongPass
+}
+
+
+// checkRepetition(1,'aaaaaaabcbc') = 'abcbc'
+// checkRepetition(2,'aaaaaaabcbc') = 'aabc'
+// checkRepetition(2,'aaaaaaabcdbcd') = 'aabcd'
+
+function checkRepetition(pLen,str) {
+ res = ""
+ for ( i=0; i<str.length ; i++ ) {
+ repeated=true
+ for (j=0;j < pLen && (j+i+pLen) < str.length;j++)
+ repeated=repeated && (str.charAt(j+i)==str.charAt(j+i+pLen))
+ if (j<pLen) repeated=false
+ if (repeated) {
+ i+=pLen-1
+ repeated=false
+ }
+ else {
+ res+=str.charAt(i)
+ }
+ }
+ return res
+}
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
new file mode 100644
index 0000000..9aeafcc
--- /dev/null
+++ b/wp-admin/js/post.js
@@ -0,0 +1,157 @@
+// this file contains all the scripts used in the post/edit page
+
+function new_tag_remove_tag() {
+ var id = jQuery( this ).attr( 'id' );
+ var num = id.substr( 10 );
+ var current_tags = jQuery( '#tags-input' ).val().split(',');
+ delete current_tags[num];
+ var new_tags = [];
+ jQuery.each( current_tags, function( key, val ) {
+ if ( val && !val.match(/^\s+$/) && '' != val ) {
+ new_tags = new_tags.concat( val );
+ }
+ });
+ jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
+ tag_update_quickclicks();
+ jQuery('#newtag').focus();
+ return false;
+}
+
+function tag_update_quickclicks() {
+ var current_tags = jQuery( '#tags-input' ).val().split(',');
+ jQuery( '#tagchecklist' ).empty();
+ shown = false;
+// jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
+ jQuery.each( current_tags, function( key, val ) {
+ val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
+ if ( !val.match(/^\s+$/) && '' != val ) {
+ txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
+ jQuery( '#tagchecklist' ).append( txt );
+ jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
+ shown = true;
+ }
+ });
+ if ( shown )
+ jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
+}
+
+function tag_flush_to_text() {
+ var newtags = jQuery('#tags-input').val() + ',' + jQuery('#newtag').val();
+ // massage
+ newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
+ jQuery('#tags-input').val( newtags );
+ tag_update_quickclicks();
+ jQuery('#newtag').val('');
+ jQuery('#newtag').focus();
+ return false;
+}
+
+function tag_save_on_publish() {
+ if ( jQuery('#newtag').val() != postL10n.addTag )
+ tag_flush_to_text();
+}
+
+function tag_press_key( e ) {
+ if ( 13 == e.keyCode ) {
+ tag_flush_to_text();
+ return false;
+ }
+}
+
+addLoadEvent( function() {
+ // postboxes
+ add_postbox_toggles('post');
+
+ // If no tags on the page, skip the tag and category stuff.
+ if ( !jQuery('#tags-input').size() ) {
+ return;
+ }
+
+ // Editable slugs
+ make_slugedit_clickable();
+
+ // hide advanced slug field
+ jQuery('#slugdiv').hide();
+
+ jQuery('#tags-input').hide();
+ tag_update_quickclicks();
+ // add the quickadd form
+ jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '"/><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
+ jQuery('#tagadd').click( tag_flush_to_text );
+ jQuery('#newtag').focus(function() {
+ if ( this.value == postL10n.addTag )
+ jQuery(this).val( '' ).removeClass( 'form-input-tip' );
+ });
+ jQuery('#newtag').blur(function() {
+ if ( this.value == '' )
+ jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
+ });
+
+ // auto-save tags on post save/publish
+ jQuery('#publish').click( tag_save_on_publish );
+ jQuery('#save-post').click( tag_save_on_publish );
+
+ // auto-suggest stuff
+ jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );
+ jQuery('#newtag').keypress( tag_press_key );
+
+ // category tabs
+ var categoryTabs =jQuery('#category-tabs').tabs();
+
+ // Ajax Cat
+ var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
+ jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
+ var newCatParent = false;
+ var newCatParentOption = false;
+ var noSyncChecks = false; // prophylactic. necessary?
+ var syncChecks = function() {
+ if ( noSyncChecks )
+ return;
+ noSyncChecks = true;
+ var th = jQuery(this);
+ var c = th.is(':checked');
+ var id = th.val().toString();
+ jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+ noSyncChecks = false;
+ };
+ var catAddAfter = function( r, s ) {
+ if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
+ if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
+ jQuery(s.what + ' response_data', r).each( function() {
+ var t = jQuery(jQuery(this).text());
+ t.find( 'label' ).each( function() {
+ var th = jQuery(this);
+ var val = th.find('input').val();
+ var id = th.find('input')[0].id
+ jQuery('#' + id).change( syncChecks );
+ if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
+ return;
+ var name = jQuery.trim( th.text() );
+ var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name );
+ newCatParent.prepend( o );
+ } );
+ newCatParentOption.attr( 'selected', true );
+ } );
+ };
+ jQuery('#categorychecklist').wpList( {
+ alt: '',
+ response: 'category-ajax-response',
+ addAfter: catAddAfter
+ } );
+ jQuery('#category-add-toggle').click( function() {
+ jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
+ categoryTabs.tabsClick( 1 );
+ jQuery('#newcat').focus();
+ return false;
+ } );
+ jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
+
+ jQuery('.edit-timestamp').click(function () {
+ if (jQuery('#timestampdiv').is(":hidden")) {
+ jQuery('#timestampdiv').slideDown("normal");
+ } else {
+ jQuery('#timestampdiv').hide();
+ }
+ return false;
+ });
+});
diff --git a/wp-admin/js/postbox.js b/wp-admin/js/postbox.js
new file mode 100644
index 0000000..a512f4b
--- /dev/null
+++ b/wp-admin/js/postbox.js
@@ -0,0 +1,14 @@
+function add_postbox_toggles(page) {
+ jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
+ jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } );
+}
+
+function save_postboxes_state(page) {
+ var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
+ jQuery.post(postboxL10n.requestFile, {
+ action: 'closed-postboxes',
+ closed: closed,
+ closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
+ page: page
+ });
+}
diff --git a/wp-admin/js/slug.js b/wp-admin/js/slug.js
new file mode 100644
index 0000000..f26a5f2
--- /dev/null
+++ b/wp-admin/js/slug.js
@@ -0,0 +1,48 @@
+function edit_permalink(post_id) {
+ var i, c = 0;
+ var e = jQuery('#editable-post-name');
+ var revert_e = e.html();
+ var real_slug = jQuery('#post_name');
+ var revert_slug = real_slug.html();
+ var b = jQuery('#edit-slug-buttons');
+ var revert_b = b.html();
+ var full = jQuery('#editable-post-name-full').html();
+
+ b.html('<a href="" class="save">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>');
+ b.children('.save').click(function() {
+ var new_slug = e.children('input').val();
+ jQuery.post(slugL10n.requestFile, {
+ action: 'sample-permalink',
+ post_id: post_id,
+ new_slug: new_slug,
+ new_title: jQuery('#title').val(),
+ samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
+ jQuery('#edit-slug-box').html(data);
+ b.html(revert_b);
+ real_slug.attr('value', new_slug);
+ make_slugedit_clickable();
+ });
+ return false;
+ });
+ jQuery('#edit-slug-buttons .cancel').click(function() {
+ e.html(revert_e);
+ b.html(revert_b);
+ real_slug.attr('value', revert_slug);
+ return false;
+ });
+ for(i=0; i < full.length; ++i) {
+ if ('%' == full.charAt(i)) c++;
+ }
+ slug_value = (c > full.length/4)? '' : full;
+ e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
+ var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+ // on enter, just save the new slug, don't save the post
+ if (13 == key) {b.children('.save').click();return false;}
+ if (27 == key) {b.children('.cancel').click();return false;}
+ real_slug.attr('value', this.value)}).focus();
+}
+
+function make_slugedit_clickable() {
+ jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
+}
+
diff --git a/wp-admin/js/tags.js b/wp-admin/js/tags.js
new file mode 100644
index 0000000..37182df
--- /dev/null
+++ b/wp-admin/js/tags.js
@@ -0,0 +1,21 @@
+jQuery(function($) {
+ var options = false
+
+ var addAfter = function( r, settings ) {
+ var name = $("<span>" + $('name', r).text() + "</span>").html();
+ var id = $('tag', r).attr('id');
+ options[options.length] = new Option(name, id);
+ }
+
+ var delAfter = function( r, settings ) {
+ var id = $('tag', r).attr('id');
+ for ( var o = 0; o < options.length; o++ )
+ if ( id == options[o].value )
+ options[o] = null;
+ }
+
+ if ( options )
+ $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
+ else
+ $('#the-list').wpList();
+});
diff --git a/wp-admin/js/widgets.js b/wp-admin/js/widgets.js
new file mode 100644
index 0000000..6bf7f2c
--- /dev/null
+++ b/wp-admin/js/widgets.js
@@ -0,0 +1,136 @@
+jQuery(function($) {
+ $('.noscript-action').remove();
+
+ var increment = 1;
+
+ // Open or close widget control form
+ var toggleWidget = function( li, disableFields ) {
+ var width = li.find('input.widget-width').val();
+
+ // it seems IE chokes on these animations because of the positioning/floating
+ var widgetAnim = $.browser.msie ? function() {
+ var t = $(this);
+ if ( t.is(':visible') ) {
+ if ( disableFields ) { t.find( ':enabled' ).not( '[name="widget-id[]"]' ).attr( 'disabled', 'disabled' ); }
+ li.css( 'marginLeft', 0 );
+ t.siblings('h4').children('a').text( widgetsL10n.edit );
+ } else {
+ t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
+ if ( width > 250 )
+ li.css( 'marginLeft', ( width - 250 ) * -1 );
+ t.siblings('h4').children('a').text( widgetsL10n.cancel );
+ }
+ t.toggle();
+ } : function() {
+ var t = $(this);
+
+ if ( t.is(':visible') ) {
+ if ( disableFields ) { t.find( ':enabled' ).not( '[name="widget-id[]"]' ).attr( 'disabled', 'disabled' ); }
+ if ( width > 250 )
+ li.animate( { marginLeft: 0 } );
+ t.siblings('h4').children('a').text( widgetsL10n.edit );
+ } else {
+ t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
+ if ( width > 250 )
+ li.animate( { marginLeft: ( width - 250 ) * -1 } );
+ t.siblings('h4').children('a').text( widgetsL10n.cancel );
+ }
+ t.animate( { height: 'toggle' } );
+ };
+
+ return li.children('div.widget-control').each( widgetAnim ).end();
+ };
+
+ // onclick for edit/cancel links
+ var editClick = function() {
+ var q = wpAjax.unserialize( this.href );
+ // if link is in available widgets list, make sure it points to the current sidebar
+ if ( ( q.sidebar && q.sidebar == $('#sidebar').val() ) || q.add ) {
+ var w = q.edit || q.add;
+ toggleWidget( $('#current-sidebar .widget-control-list input[@name^="widget-id"][@value=' + w + ']').parents('li:first'), false ).blur();
+ return false;
+ } else if ( q.sidebar ) { // otherwise, redirect to correct page
+ return true;
+ }
+
+ // If link is in current widgets list, just open the form
+ toggleWidget( $(this).parents('li:first'), true ).blur();
+ return false;
+ };
+
+ // onclick for add links
+ var addClick = function() {
+ var oldLi = $(this).parents('li:first').find('ul.widget-control-info li');
+ var newLi = oldLi.clone();
+
+ if ( newLi.html().match( /%i%/ ) ) {
+ // supplid form is a template, replace %i% by unique id
+ var i = $('#generated-time').val() + increment.toString();
+ increment++;
+ newLi.html( newLi.html().replace( /%i%/g, i ) );
+ } else {
+ $(this).text( widgetsL10n.edit ).unbind().click( editClick );
+ // save form content in textarea so we don't have any conflicting HTML ids
+ oldLi.html( '<textarea>' + oldLi.html() + '</textarea>' );
+ }
+
+ // add event handlers
+ addWidgetControls( newLi );
+
+ // add widget to sidebar sortable
+ widgetSortable.append( newLi ).SortableAddItem( newLi[0] );
+
+ // increment widget counter
+ var n = parseInt( $('#widget-count').text(), 10 ) + 1;
+ $('#widget-count').text( n.toString() )
+
+ return false;
+ };
+
+ // add event handlers to all links found in context
+ var addWidgetControls = function( context ) {
+ if ( !context )
+ context = document;
+
+ $('a.widget-control-edit', context).click( editClick );
+
+ // onclick for save links
+ $('a.widget-control-save', context).click( function() {
+ toggleWidget( $(this).parents('li:first'), false ).blur()
+ return false;
+ } );
+
+ // onclick for remove links
+ $('a.widget-control-remove', context).click( function() {
+ var w = $(this).parents('li:first').find('input[@name^="widget-id"]').val();
+ $(this).parents('li:first').remove();
+ var t = $('#widget-list ul#widget-control-info-' + w + ' textarea');
+ t.parent().html( t.text() ).parents('li.widget-list-item:first').children( 'h4' ).children('a.widget-action')
+ .show().text( widgetsL10n.add ).unbind().click( addClick );
+ var n = parseInt( $('#widget-count').text(), 10 ) - 1;
+ $('#widget-count').text( n.toString() )
+ return false;
+ } );
+ }
+
+ addWidgetControls();
+
+ $('a.widget-control-add').click( addClick );
+
+ var widgetSortable;
+ var widgetSortableInit = function() {
+ try { // a hack to make sortables work in jQuery 1.2+ and IE7
+ $('#current-sidebar .widget-control-list').SortableDestroy();
+ } catch(e) {}
+ widgetSortable = $('#current-sidebar .widget-control-list').Sortable( {
+ accept: 'widget-sortable',
+ helperclass: 'sorthelper',
+ handle: 'h4.widget-title',
+ onStop: widgetSortableInit
+ } );
+ }
+
+ // initialize sortable
+ widgetSortableInit();
+
+});
diff --git a/wp-admin/media-upload.php b/wp-admin/media-upload.php
new file mode 100644
index 0000000..e756166
--- /dev/null
+++ b/wp-admin/media-upload.php
@@ -0,0 +1,41 @@
+<?php
+require_once('admin.php');
+wp_enqueue_script('swfupload');
+wp_enqueue_script('swfupload-degrade');
+wp_enqueue_script('swfupload-queue');
+wp_enqueue_script('swfupload-handlers');
+
+@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+
+if (!current_user_can('upload_files'))
+ wp_die(__('You do not have permission to upload files.'));
+
+// IDs should be integers
+$ID = isset($ID)? (int) $ID : 0;
+$post_id = isset($post_id)? (int) $post_id : 0;
+
+// Require an ID for the edit screen
+if ( isset($action) && $action == 'edit' && !$ID )
+ wp_die(__("You are not allowed to be here"));
+
+// upload type: image, video, file, ..?
+if ( isset($_GET['type']) )
+ $type = strval($_GET['type']);
+else
+ $type = apply_filters('media_upload_default_type', 'file');
+
+// tab: gallery, library, or type-specific
+if ( isset($_GET['tab']) )
+ $tab = strval($_GET['tab']);
+else
+ $tab = apply_filters('media_upload_default_tab', 'type');
+
+$body_id = 'media-upload';
+
+// let the action code decide how to handle the request
+if ( $tab == 'type' )
+ do_action("media_upload_$type");
+else
+ do_action("media_upload_$tab");
+
+?>
diff --git a/wp-admin/media.php b/wp-admin/media.php
new file mode 100644
index 0000000..bd64104
--- /dev/null
+++ b/wp-admin/media.php
@@ -0,0 +1,87 @@
+<?php
+
+require_once('admin.php');
+
+$parent_file = 'edit.php';
+$submenu_file = 'upload.php';
+
+wp_reset_vars(array('action'));
+
+switch( $action ) :
+case 'upload' :
+case 'delete' : break; // stubs
+case 'editattachment' :
+ $errors = media_upload_form_handler();
+ if ( empty($errors) ) {
+ wp_redirect( add_query_arg( 'message', 'updated' ) );
+ exit;
+ break;
+ }
+ // no break
+case 'edit' :
+ $title = __('Edit Media');
+
+ if ( empty($errors) )
+ $errors = null;
+
+ if ( empty( $_GET['attachment_id'] ) ) {
+ wp_redirect('upload.php');
+ exit();
+ }
+ $att_id = (int) $_GET['attachment_id'];
+ $att = get_post($att_id);
+
+ add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
+
+ wp_enqueue_script( 'wp-ajax-response' );
+ add_action('admin_head', 'media_admin_css');
+
+ require( 'admin-header.php' );
+
+ $message = '';
+ $class = '';
+ if ( isset($_GET['message']) ) {
+ switch ( $_GET['message'] ) :
+ case 'updated' :
+ $message = __('Media attachment updated.');
+ $class = 'updated fade';
+ break;
+ endswitch;
+ }
+ if ( $message )
+ echo "<div id='message' class='$class'><p>$message</p></div>\n";
+
+?>
+
+<div class="wrap">
+
+<h2><?php _e( 'Edit Media' ); ?></h2>
+
+<form method="post" action="<?php echo clean_url( remove_query_arg( 'message' ) ); ?>" class="media-upload-form" id="media-single-form">
+<div id="media-items" class="media-single">
+<div id='media-item-<?php echo $att_id; ?>' class='media-item'>
+<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'errors' => $errors ) ); ?>
+</div>
+</div>
+
+<p class="submit">
+<input type="submit" class="button" name="save" value="<?php _e('Save Changes'); ?>" />
+<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
+<input type="hidden" name="action" value="editattachment" />
+<?php wp_nonce_field('media-form'); ?>
+</p>
+
+
+</div>
+
+<?php
+
+ require( 'admin-footer.php' );
+
+ break;
+endswitch;
+
+wp_redirect( 'upload.php' );
+exit;
+
+?>
diff --git a/wp-admin/update.php b/wp-admin/update.php
new file mode 100644
index 0000000..b047384
--- /dev/null
+++ b/wp-admin/update.php
@@ -0,0 +1,127 @@
+<?php
+
+require_once('admin.php');
+
+if ( !current_user_can('edit_plugins') )
+ wp_die('<p>'.__('You do not have sufficient permissions to update plugins for this blog.').'</p>');
+
+function request_filesystem_credentials($form_post, $type = '', $error = false) {
+ if ( empty($type) )
+ $type = get_filesystem_method();
+
+ if ( 'direct' == $type )
+ return array();
+
+ if ( ! $error && !empty($_POST['password']) && !empty($_POST['username']) && !empty($_POST['hostname']) ) {
+ $credentials = array('hostname' => $_POST['hostname'], 'username' => $_POST['username'],
+ 'password' => $_POST['password'], 'ssl' => $_POST['ssl']);
+ $stored_credentials = $credentials;
+ unset($stored_credentials['password']);
+ update_option('ftp_credentials', $stored_credentials);
+ return $credentials;
+ }
+ $hostname = '';
+ $username = '';
+ $password = '';
+ $ssl = '';
+ if ( $credentials = get_option('ftp_credentials') )
+ extract($credentials, EXTR_OVERWRITE);
+ if( $error ){
+ echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.') . '</p></div>';
+ }
+?>
+<form action="<?php echo $form_post ?>" method="post">
+<div class="wrap">
+<h2><?php _e('FTP Connection Information') ?></h2>
+<p><?php _e('To perform the requested update, FTP connection information is required.') ?></p>
+<table class="form-table">
+<tr valign="top">
+<th scope="row"><?php _e('Hostname:') ?></th>
+<td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>" size="40" /></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('Username:') ?></th>
+<td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>" size="40" /></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('Password:') ?></th>
+<td><input name="password" type="password" id="password" value="<?php echo attribute_escape($password) ?>" size="40" /></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('Use SSL:') ?></th>
+<td>
+<select name="ssl" id="ssl">
+<?php
+foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) :
+ $selected = ($ssl == $value) ? 'selected="selected"' : '';
+ echo "\n\t<option value='$key' $selected>" . $value . '</option>';
+endforeach;
+?>
+</select>
+</td>
+</tr>
+</table>
+<p class="submit">
+<input type="submit" name="submit" value="<?php _e('Proceed'); ?>" />
+</p>
+</div>
+</form>
+<?php
+ return false;
+}
+
+function show_message($message) {
+ if( is_wp_error($message) ){
+ if( $message->get_error_data() )
+ $message = $message->get_error_message() . ': ' . $message->get_error_data();
+ else
+ $message = $message->get_error_message();
+ }
+ echo "<p>$message</p>";
+}
+
+function do_plugin_upgrade($plugin) {
+ global $wp_filesystem;
+
+ $url = wp_nonce_url("update.php?action=upgrade-plugin&plugin=$plugin", "upgrade-plugin_$plugin");
+ if ( false === ($credentials = request_filesystem_credentials($url)) )
+ return;
+
+ if( ! WP_Filesystem($credentials) ){
+ request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+ return;
+ }
+
+ echo '<div class="wrap">';
+ echo '<h2>' . __('Upgrade Plugin') . '</h2>';
+ if ( $wp_filesystem->errors->get_error_code() ) {
+ foreach ( $wp_filesystem->errors->get_error_messages() as $message )
+ show_message($message);
+ echo '</div>';
+ return;
+ }
+
+ $result = wp_update_plugin($plugin, 'show_message');
+
+ if ( is_wp_error($result) )
+ show_message($result);
+ else
+ echo __('Plugin upgraded successfully');
+ echo '</div>';
+}
+
+if ( isset($_GET['action']) ) {
+ if ( isset($_GET['plugin']) )
+ $plugin = trim($_GET['plugin']);
+
+ if ( 'upgrade-plugin' == $_GET['action'] ) {
+ check_admin_referer('upgrade-plugin_' . $plugin);
+ $title = __('Upgrade Plugin');
+ $parent_file = 'plugins.php';
+ require_once('admin-header.php');
+ do_plugin_upgrade($plugin);
+ include('admin-footer.php');
+ }
+}
+
+?>
diff --git a/wp-admin/wpmu-blogs.php.rej b/wp-admin/wpmu-blogs.php.rej
new file mode 100644
index 0000000..c3aebfd
--- /dev/null
+++ b/wp-admin/wpmu-blogs.php.rej
@@ -0,0 +1,1224 @@
+***************
+*** 1,570 ****
+ <?php
+ require_once('admin.php');
+
+- $title = __('WPMU Admin: Blogs');
+ $parent_file = 'wpmu-admin.php';
+ require_once('admin-header.php');
+ if( is_site_admin() == false ) {
+- die( __('<p>You do not have permission to access this page.</p>') );
+ }
+- if (isset($_GET['updated'])) {
+- ?><div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div><?php
+- }
+- print '<div class="wrap">';
+- switch( $_GET[ 'action' ] ) {
+- case "editblog":
+- $id = intval( $_GET[ 'id' ] );
+- $options_table_name = "$wpmuBaseTablePrefix{$id}_options";
+- $options = $wpdb->get_results( "SELECT * FROM {$options_table_name} WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A );
+- $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A );
+- $editblog_roles = get_blog_option( $id, "$wpmuBaseTablePrefix{$id}_user_roles" );
+
+- print "<h2>" . __('Edit Blog') . "</h2>";
+- print "<a href='http://{$details[ 'domain' ]}/'>{$details[ 'domain' ]}</a>";
+- ?>
+- <form name="form1" method="post" action="wpmu-edit.php?action=updateblog">
+- <?php wp_nonce_field( "editblog" ); ?>
+- <input type="hidden" name="id" value="<?php echo $id ?>" />
+- <table><td valign='top'>
+- <div class="wrap">
+- <table width="100%" border='0' cellspacing="2" cellpadding="5" class="editform">
+- <tr valign="top">
+- <th scope="row"><?php _e('URL') ?></th>
+- <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details[ 'domain' ] ?>" size="33" /></td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e('Path') ?></th>
+- <td><input name="blog[path]" type="text" id="path" value="<?php echo $details[ 'path' ] ?>" size="40" /></td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e('Registered') ?></th>
+- <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details[ 'registered' ] ?>" size="40" /></td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e('Last Updated') ?></th>
+- <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details[ 'last_updated' ] ?>" size="40" /></td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e('Public') ?></th>
+- <td><input type='radio' name='blog[public]' value='1' <?php if( $details[ 'public' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?>&nbsp;&nbsp;
+- <input type='radio' name='blog[public]' value='0' <?php if( $details[ 'public' ] == '0' ) echo " checked"?>> <?php _e('No') ?> &nbsp;&nbsp;
+- </td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e( 'Archived' ); ?></th>
+- <td><input type='radio' name='blog[archived]' value='1' <?php if( $details[ 'archived' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?>&nbsp;&nbsp;
+- <input type='radio' name='blog[archived]' value='0' <?php if( $details[ 'archived' ] == '0' ) echo " checked"?>> <?php _e('No') ?> &nbsp;&nbsp;
+- </td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e( 'Mature' ); ?></th>
+- <td><input type='radio' name='blog[mature]' value='1' <?php if( $details[ 'mature' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?>&nbsp;&nbsp;
+- <input type='radio' name='blog[mature]' value='0' <?php if( $details[ 'mature' ] == '0' ) echo " checked"?>> <?php _e('No') ?> &nbsp;&nbsp;
+- </td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e( 'Spam' ); ?></th>
+- <td><input type='radio' name='blog[spam]' value='1' <?php if( $details[ 'spam' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?>&nbsp;&nbsp;
+- <input type='radio' name='blog[spam]' value='0' <?php if( $details[ 'spam' ] == '0' ) echo " checked"?>> <?php _e('No') ?> &nbsp;&nbsp;
+- </td>
+- </tr>
+- <tr valign="top">
+- <th scope="row"><?php _e( 'Deleted' ); ?></th>
+- <td><input type='radio' name='blog[deleted]' value='1' <?php if( $details[ 'deleted' ] == '1' ) echo " checked"?>> <?php _e('Yes') ?>&nbsp;&nbsp;
+- <input type='radio' name='blog[deleted]' value='0' <?php if( $details[ 'deleted' ] == '0' ) echo " checked"?>> <?php _e('No') ?> &nbsp;&nbsp;
+- </td>
+- </tr>
+- <tr><td colspan='2'>
+- <br />
+- <br />
+- </td></tr>
+- <?php
+- $editblog_default_role = 'subscriber';
+- while( list( $key, $val ) = each( $options ) ) {
+- if( $val[ 'option_name' ] == 'default_role' )
+- $editblog_default_role = $val[ 'option_value' ];
+- $disabled = '';
+- if ( is_serialized($val[ 'option_value' ]) ) {
+- if ( is_serialized_string($val[ 'option_value' ]) ) {
+- $val[ 'option_value' ] = wp_specialchars(maybe_unserialize($val[ 'option_value' ]), 'single');
+- } else {
+- $val[ 'option_value' ] = "SERIALIZED DATA";
+- $disabled = ' disabled="disabled"';
+- }
+ }
+- if ( stristr($val[ 'option_value' ], "\r") or stristr($val[ 'option_value' ], "\n") or stristr($val[ 'option_value' ], "\r\n") ) {
+ ?>
+- <tr valign="top">
+- <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>
+- <td><textarea rows="5" cols="40" name="option[<?php echo $val[ 'option_name' ] ?>]" type="text" id="<?php echo $val[ 'option_name' ] ?>"<?php echo $disabled ?>><?php echo wp_specialchars( stripslashes( $val[ 'option_value' ] ), 1 ) ?></textarea></td>
+- </tr>
+- <?php
+- } else {
+ ?>
+- <tr valign="top">
+- <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>
+- <td><input name="option[<?php echo $val[ 'option_name' ] ?>]" type="text" id="<?php echo $val[ 'option_name' ] ?>" value="<?php echo wp_specialchars( stripslashes( $val[ 'option_value' ] ), 1 ) ?>" size="40" <?php echo $disabled ?>/></td>
+- </tr>
+ <?php
+- }
+- }
+- ?>
+- </table>
+- <p class="submit">
+- <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+- </p>
+- </div>
+- </td>
+- <td valign='top'>
+- <?php
+- $themes = get_themes();
+- $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
+- $allowed_themes = get_site_option( "allowedthemes" );
+- if( $allowed_themes == false ) {
+- $allowed_themes = array_keys( $themes );
+- }
+- $out = '';
+- foreach( $themes as $key => $theme ) {
+- $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
+- if( isset( $allowed_themes[ $theme_key ] ) == false ) {
+- if( isset( $blog_allowed_themes[ $theme_key ] ) == true ) {
+- $checked = 'checked ';
+- } else {
+- $checked = '';
+- }
+-
+- $out .= '
+- <tr valign="top">
+- <th title="' . htmlspecialchars( $theme[ "Description" ] ) . '" scope="row">'.$key.'</th>
+- <td><input name="theme['.$theme_key.']" type="checkbox" id="'.$key.'" value="on" '.$checked.'/></td>
+- </tr> ';
+- }
+- }
+- if( $out != '' ) {
+- print "<div class='wrap'><h3>" . __('Blog Themes') . "</h3>";
+- print '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">';
+- print '<tr><th>' . __('Theme') . '</th><th>' . __('Enable') . '</th></tr>';
+- print $out;
+- print "</table></div>";
+- }
+- $blogusers = get_users_of_blog( $id );
+- print '<div class="wrap"><h3>' . __('Blog Users') . '</h3>';
+- if( is_array( $blogusers ) ) {
+- print '<table width="100%"><caption>' . __('Current Users') . '</caption>';
+- print "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th><th></th></tr>";
+- reset( $blogusers );
+- while( list( $key, $val ) = each( $blogusers ) )
+- {
+- $t = @unserialize( $val->meta_value );
+- if( is_array( $t ) ) {
+- reset( $t );
+- $existing_role = key( $t );
+- }
+- print "<tr><td>" . $val->user_login . "</td>";
+- if( $val->user_id != $current_user->data->ID ) {
+- ?>
+- <td><select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
+- foreach( $editblog_roles as $role => $role_assoc ){
+- $selected = '';
+- if( $role == $existing_role )
+- $selected = 'selected="selected"';
+- echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>";
+- }
+- ?></select></td><td><input type='text' name='user_password[<?php echo $val->user_id ?>]'></td><?php
+- print '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']"></td>';
+- } else {
+- print "<td><b>" . __ ('N/A') . "</b></td><td><b>" . __ ('N/A') . "</b></td><td><b>" . __('N/A') . "</b></td>";
+- }
+- print '<td><a href="user-edit.php?user_id=' . $val->user_id . '">' . __('Edit') . "</td></tr>";
+- }
+- print "</table>";
+- }
+- print "<h3>" . __('Add a new user') . "</h3>";
+- ?>
+- <p><?php _e('As you type WordPress will offer you a choice of usernames.<br /> Click them to select and hit <em>Update Options</em> to add the user.') ?></p>
+- <table>
+- <tr><th scope="row"><?php _e('User&nbsp;Login:') ?> </th><td><input type="text" name="newuser" id="newuser"></td></tr>
+- <tr><td></td><td></td> </tr>
+- <tr>
+- <th scope="row"><?php _e('Role:') ?></th>
+- <td><select name="new_role" id="new_role"><?php
+- reset( $editblog_roles );
+- foreach( $editblog_roles as $role => $role_assoc ){
+- $selected = '';
+- if( $role == $editblog_default_role )
+- $selected = 'selected="selected"';
+- echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>";
+- }
+- ?></select></td>
+- </tr>
+- </table>
+- </div>
+- <div class='wrap'><strong><?php _e('Misc Blog Actions') ?></strong>
+- <p><?php do_action( "wpmueditblogaction", $_GET[ 'id' ] ); ?></p>
+- </div>
+- <p class="submit">
+- <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+- </p>
+-
+- </td>
+- </table>
+- <?php
+- break;
+- default:
+- if( isset( $_GET[ 'start' ] ) == false ) {
+- $start = 0;
+- } else {
+- $start = intval( $_GET[ 'start' ] );
+- }
+- if( isset( $_GET[ 'num' ] ) == false ) {
+- $num = 60;
+- } else {
+- $num = intval( $_GET[ 'num' ] );
+- }
+-
+- $query = "SELECT *
+- FROM ".$wpdb->blogs."
+- WHERE site_id = '".$wpdb->siteid."' ";
+- if( $_GET[ 's' ] != '' ) {
+ $query = "SELECT blog_id, {$wpdb->blogs}.domain, {$wpdb->blogs}.path, registered, last_updated
+- FROM $wpdb->blogs, $wpdb->site
+- WHERE site_id = '$wpdb->siteid'
+- AND {$wpdb->blogs}.site_id = {$wpdb->site}.id
+- AND ( {$wpdb->blogs}.domain LIKE '%". trim( $_GET[ 's' ] )."%' OR {$wpdb->blogs}.path LIKE '%". trim( $_GET[ 's' ] )."%' )";
+- } elseif( $_GET[ 'blog_id' ] != '' ) {
+ $query = "SELECT *
+- FROM $wpdb->blogs
+- WHERE site_id = '$wpdb->siteid'
+- AND blog_id = '".intval($_GET[ 'blog_id' ])."'";
+- } elseif( $_GET[ 'ip_address' ] != '' ) {
+- $query = "SELECT *
+- FROM $wpdb->blogs, wp_registration_log
+- WHERE site_id = '$wpdb->siteid'
+- AND {$wpdb->blogs}.blog_id = wp_registration_log.blog_id
+- AND wp_registration_log.IP LIKE ('%".$_GET[ 'ip_address' ]."%')";
+ }
+- if( isset( $_GET[ 'sortby' ] ) == false ) {
+- $_GET[ 'sortby' ] = 'id';
+ }
+- if( $_GET[ 'sortby' ] == 'registered' ) {
+ $query .= ' ORDER BY registered ';
+- } elseif( $_GET[ 'sortby' ] == 'id' ) {
+ $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
+- } elseif( $_GET[ 'sortby' ] == 'lastupdated' ) {
+ $query .= ' ORDER BY last_updated ';
+- } elseif( $_GET[ 'sortby' ] == 'blogname' ) {
+ $query .= ' ORDER BY domain ';
+ }
+- if( $_GET[ 'order' ] == 'DESC' ) {
+- $query .= "DESC";
+- } else {
+- $query .= "ASC";
+ }
+
+- if ( $_GET[ 'ip_address' ] == '' )
+- $query .= " LIMIT " . intval( $start ) . ", " . intval( $num );
+- $blog_list = $wpdb->get_results( $query, ARRAY_A );
+- if( count( $blog_list ) < $num ) {
+- $next = false;
+ } else {
+- $next = true;
+ }
+- ?>
+- <script language="javascript">
+- <!--
+- var checkflag = "false";
+- function check_all_rows() {
+- field = document.formlist;
+- if (checkflag == "false") {
+- for (i = 0; i < field.length; i++) {
+- if( field[i].name == 'allblogs[]' )
+- field[i].checked = true;}
+- checkflag = "true";
+- return "<?php _e('Uncheck All') ?>";
+- } else {
+- for (i = 0; i < field.length; i++) {
+- if( field[i].name == 'allblogs[]' )
+- field[i].checked = false; }
+- checkflag = "false";
+- return "<?php _e('Check All') ?>";
+- }
+- }
+
+- // -->
+- </script>
+
+- <h2><?php _e('Blogs') ?></h2>
+- <form name="searchform" action="wpmu-blogs.php" method="get" style="float: left; margin-right: 3em;">
+- <table><td>
+- <fieldset>
+- <legend><?php _e('Search Blogs&hellip;') ?></legend>
+- <input type='hidden' name='action' value='blogs'>
+- <?php _e('Name:') ?>&nbsp;<input type="text" name="s" value="<?php if (isset($_GET[ 's' ])) echo wp_specialchars($_GET[ 's' ], 1); ?>" size="17" /><br />
+- <?php _e('Blog&nbsp;ID:') ?>&nbsp;<input type="text" name="blog_id" value="<?php if (isset($_GET[ 'blog_id' ])) echo wp_specialchars($_GET[ 'blog_id' ], 1); ?>" size="10" /><br />
+- <?php _e('IP Address:') ?> <input type="text" name="ip_address" value="<?php if (isset($_GET[ 'ip_address' ])) echo wp_specialchars($_GET[ 'ip_address' ], 1); ?>" size="10" /><br />
+- <input type="submit" name="submit" value="<?php _e('Search') ?>" />
+- </fieldset>
+- <?php
+- if( isset($_GET[ 's' ]) && $_GET[ 's' ] != '' ) {
+- ?><a href="/wp-admin/wpmu-users.php?action=users&s=<?php echo wp_specialchars($_GET[ 's' ], 1) ?>"><?php _e('Search Users:') ?> <?php echo wp_specialchars($_GET[ 's' ], 1) ?></a><?php
+- }
+- ?>
+- </td><td valign='top'>
+- <fieldset>
+- <legend><?php _e('Blog Navigation') ?></legend>
+- <?php
+
+- $url2 = "order=" . $_GET[ 'order' ] . "&sortby=" . $_GET[ 'sortby' ] . "&s=" . $_GET[ 's' ] . "&ip_address=" . $_GET[ 'ip_address' ];
+
+- $blog_navigation = '';
+- if( $start == 0 ) {
+- $blog_navigation .= __('Previous&nbsp;Blogs');
+- } elseif( $start <= 30 ) {
+- $blog_navigation .= '<a href="wpmu-blogs.php?start=0&' . $url2 . ' ">' . __('Previous&nbsp;Blogs') . '</a>';
+- } else {
+- $blog_navigation .= '<a href="wpmu-blogs.php?start=' . ( $start - $num ) . '&' . $url2 . '">' . __('Previous&nbsp;Blogs') . '</a>';
+- }
+- if ( $next ) {
+- $blog_navigation .= '&nbsp;||&nbsp;<a href="wpmu-blogs.php?start=' . ( $start + $num ) . '&' . $url2 . '">' . __('Next&nbsp;Blogs') . '</a>';
+- } else {
+- $blog_navigation .= '&nbsp;||&nbsp;' . __('Next&nbsp;Blogs');
+- }
+- echo $blog_navigation;
+- ?>
+- </fieldset>
+- </td></table>
+- </form>
+
+- <br style="clear:both;" />
+
+- <?php
+
+- // define the columns to display, the syntax is 'internal name' => 'display name'
+- $posts_columns = array(
+- 'id' => __('ID'),
+- 'blogname' => __('Blog Name'),
+- 'lastupdated' => __('Last Updated'),
+- 'registered' => __('Registered'),
+- 'users' => __('Users'),
+- 'plugins' => __('Actions')
+- );
+- $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+
+- // you can not edit these at the moment
+- $posts_columns['control_view'] = '';
+- $posts_columns['control_edit'] = '';
+- $posts_columns['control_backend'] = '';
+- $posts_columns['control_deactivate'] = '';
+- $posts_columns['control_archive'] = '';
+- $posts_columns['control_spam'] = '';
+- $posts_columns['control_delete'] = '';
+
+- $sortby_url = "s=" . $_GET[ 's' ] . "&ip_address=" . $_GET[ 'ip_address' ];
+- ?>
+
+- <form name='formlist' action='wpmu-edit.php?action=allblogs' method='POST'>
+- <input type=button value="<?php _e('Check All') ?>" onClick="this.value=check_all_rows()">
+- <table width="100%" cellpadding="3" cellspacing="3">
+- <tr>
+
+- <?php foreach($posts_columns as $column_id => $column_display_name) { ?>
+- <th scope="col"><a href="wpmu-blogs.php?<?php echo $sortby_url ?>&sortby=<?php echo $column_id ?>&<?php if( $_GET[ 'sortby' ] == $column_id ) { if( $_GET[ 'order' ] == 'DESC' ) { echo "order=ASC&" ; } else { echo "order=DESC&"; } } ?>start=<?php echo $start ?>"><?php echo $column_display_name; ?></a></th>
+- <?php } ?>
+
+- </tr>
+- <?php
+- if ($blog_list) {
+- $bgcolor = '';
+- $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
+- foreach ($blog_list as $blog) {
+- $class = ('alternate' == $class) ? '' : 'alternate';
+- reset( $status_list );
+- $bgcolour = "";
+- while( list( $status, $col ) = each( $status_list ) ) {
+- if( get_blog_status( $blog[ 'blog_id' ], $status ) == 1 ) {
+- $bgcolour = "style='background: $col'";
+- }
+- }
+- print "<tr $bgcolour class='$class'>";
+- if( constant( "VHOST" ) == 'yes' ) {
+- $blogname = str_replace( '.' . $current_site->domain, '', $blog[ 'domain' ] );
+- } else {
+- $blogname = $blog[ 'path' ];
+- }
+
+- foreach($posts_columns as $column_name=>$column_display_name) {
+
+- switch($column_name) {
+-
+- case 'id':
+- ?>
+- <th scope="row"><input type='checkbox' id='<?php echo $blog[ 'blog_id' ] ?>' name='allblogs[]' value='<?php echo $blog[ 'blog_id' ] ?>'> <label for='<?php echo $blog[ 'blog_id' ] ?>'><?php echo $blog[ 'blog_id' ] ?></label></th>
+- <?php
+- break;
+
+- case 'blogname':
+- ?>
+- <td valign='top'><label for='<?php echo $blog[ 'blog_id' ] ?>'><?php echo $blogname ?></label>
+- </td>
+- <?php
+- break;
+
+- case 'lastupdated':
+- ?>
+- <td valign='top'><?php echo $blog[ 'last_updated' ] == '0000-00-00 00:00:00' ? __("Never") : $blog[ 'last_updated' ] ?></td>
+- <?php
+- break;
+
+- case 'registered':
+- ?>
+- <td valign='top'><?php echo $blog[ 'registered' ] ?></td>
+- <?php
+- break;
+-
+- case 'users':
+- ?>
+- <td valign='top'><?php
+- $blogusers = get_users_of_blog( $blog[ 'blog_id' ] );
+- if( is_array( $blogusers ) ) {
+- if( $blog[ 'blog_id' ] == 1 && count( $blogusers ) > 10 )
+- $blogusers = array_slice( $blogusers, 0, 10 );
+- while( list( $key, $val ) = each( $blogusers ) )
+- print '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<BR>';
+- }
+- ?></td>
+- <?php
+- break;
+-
+- case 'control_view':
+- ?>
+- <td valign='top'><a href="http://<?php echo $blog[ 'domain' ]. $blog[ 'path' ]; ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
+- <?php
+- break;
+-
+- case 'control_edit':
+- ?>
+- <td valign='top'><?php echo "<a href='wpmu-blogs.php?action=editblog&amp;id=".$blog[ 'blog_id' ]."' class='edit'>" . __('Edit') . "</a>"; ?></td>
+- <?php
+- break;
+-
+- case 'control_backend':
+- ?>
+- <td valign='top'><?php echo "<a href='http://" . $blog[ 'domain' ] . $blog[ 'path' ] . "wp-admin/' class='edit'>" . __('Backend') . "</a>"; ?></td>
+- <?php
+- break;
+-
+- case 'control_spam':
+- if( get_blog_status( $blog[ 'blog_id' ], "spam" ) == '1' ) {
+- ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=unspamblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) ?>"><?php _e("Not Spam") ?></a></td>
+ <?php
+- } else {
+ ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=spamblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) ?>"><?php _e("Spam") ?></a></td>
+- <?php
+- }
+- break;
+
+- case 'control_deactivate':
+- if( get_blog_status( $blog[ 'blog_id' ], "deleted" ) == '1' ) {
+- ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=activateblog&ref=<?php echo urlencode( $_SERVER[ 'REQUEST_URI' ] ) ?>&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) ?>"><?php _e("Activate") ?></a></td>
+- <?php
+- } else {
+- ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=deactivateblog&ref=<?php echo urlencode( $_SERVER[ 'REQUEST_URI' ] ) ?>&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) ?>"><?php _e("Deactivate") ?></a></td>
+- <?php
+- }
+- break;
+-
+- case 'control_archive':
+- if( get_blog_status( $blog[ 'blog_id' ], "archived" ) == '1' ) {
+- ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=unarchiveblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) ?>"><?php _e("Unarchive") ?></a></td>
+- <?php
+- } else {
+- ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=archiveblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) ?>"><?php _e("Archive") ?></a></td>
+- <?php
+- }
+- break;
+-
+- case 'control_delete':
+- ?>
+- <td valign='top'><a class='edit' href="wpmu-edit.php?action=confirm&action2=deleteblog&id=<?php echo $blog[ 'blog_id' ] ?>&msg=<?php echo urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) ?>"><?php _e("Delete") ?></a></td>
+ <?php
+- break;
+-
+- case 'plugins':
+- ?>
+- <td valign='top'><?php do_action( "wpmublogsaction", $blog[ 'blog_id' ] ); ?></td>
+- <?php
+- break;
+-
+- default:
+- ?>
+- <td valign='top'><?php do_action('manage_blogs_custom_column', $column_name, $id); ?></td>
+- <?php
+- break;
+- }
+- }
+- ?>
+- </tr>
+- <?php
+- }
+- } else {
+- ?>
+- <tr style='background-color: <?php echo $bgcolor; ?>'>
+- <td colspan="8"><?php _e('No blogs found.') ?></td>
+- </tr>
+- <?php
+- } // end if ($blogs)
+- ?>
+- </table>
+- <table width='100%'>
+- <tr><td width='20%'>
+- <input type=button value="<?php _e('Check All') ?>" onClick="this.value=check_all_rows()">
+- <p><?php _e('Selected Blogs:') ?><ul>
+- <li><input type='radio' name='blogfunction' id='delete' value='delete'> <label for='delete'><?php _e('Delete') ?></label></li>
+- <li><input type='radio' name='blogfunction' id='spam' value='spam'> <label for='spam'><?php _e('Mark as Spam') ?></label></li>
+- <?php wp_nonce_field( "allblogs" ); ?>
+- </ul>
+- <input type='hidden' name='redirect' value='<?php echo $_SERVER[ 'REQUEST_URI' ] ?>'>
+- <input type='submit' value='<?php _e('Apply Changes') ?>'></p>
+- </form>
+- </td><td>
+- <fieldset>
+- <legend><?php _e('Blog Navigation') ?></legend>
+- <?php
+- echo $blog_navigation;
+- ?>
+- </fieldset>
+- </td></tr>
+- </table>
+- </div>
+- <div class="wrap">
+- <h2><?php _e('Add Blog') ?></h2>
+- <form name="addform" method="post" action="wpmu-edit.php?action=addblog">
+- <?php wp_nonce_field('add-blog') ?>
+- <table>
+- <tr><th scope='row'><?php _e('Blog Address') ?></th><td><?php
+- if( constant( "VHOST" ) == 'yes' ) {
+- ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?></td></tr><?php
+- } else {
+- echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/></td></tr><?php
+- } ?>
+- <tr><th scope='row'><?php _e('Blog Title') ?></th><td><input name="blog[title]" type="text" title="<?php _e('Title') ?>"/></td></tr>
+- <tr><th scope='row'><?php _e('Admin Email') ?></th><td><input name="blog[email]" type="text" title="<?php _e('Email') ?>"/></td></tr>
+- <tr><td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?></td></tr>
+- </table>
+- <input type="submit" name="go" value="<?php _e('Add Blog') ?>" />
+- </form>
+- </div>
+- <?php
+-
+- break;
+ } // end switch( $action )
+- ?>
+
+- </div>
+- <?php include('admin-footer.php'); ?>
+--- 1,651 ----
+ <?php
+ require_once('admin.php');
+
++ $title = __('WordPress MU &rsaquo; Admin &rsaquo; Blogs');
+ $parent_file = 'wpmu-admin.php';
++ wp_enqueue_script( 'listman' );
+ require_once('admin-header.php');
++
+ if( is_site_admin() == false ) {
++ wp_die( __('<p>You do not have permission to access this page.</p>') );
+ }
+
++ $id = intval( $_GET['id'] );
++
++ if ( $_GET['updated'] == 'true' ) {
++ ?>
++ <div id="message" class="updated fade"><p>
++ <?php
++ switch ($_GET['action']) {
++ case 'all_spam':
++ _e('Blogs mark as spam !');
++ break;
++ case 'all_delete':
++ _e('Blogs deleted !');
++ break;
++ case 'delete':
++ _e('Blog deleted !');
++ break;
++ case 'add-blog':
++ _e('Blog added !');
++ break;
++ case 'archive':
++ _e('Blog archived !');
++ break;
++ case 'unarchive':
++ _e('Blog unarchived !');
++ break;
++ case 'activate':
++ _e('Blog activated !');
++ break;
++ case 'deactivate':
++ _e('Blog deactivated !');
++ break;
++ case 'unspam':
++ _e('Blog mark as not spam !');
++ break;
++ case 'spam':
++ _e('Blog mark as spam !');
++ break;
++ case 'umature':
++ _e('Blog mark as not mature !');
++ break;
++ case 'mature':
++ _e('Blog mark as mature !');
++ break;
++ default:
++ _e('Options saved !');
++ break;
+ }
+ ?>
++ </p></div>
++ <?php
++ }
++
++ switch( $_GET['action'] ) {
++ // Edit blog
++ case "editblog":
++ $options = $wpdb->get_results( "SELECT * FROM {$wpmuBaseTablePrefix}{$id}_options WHERE option_name NOT LIKE 'rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A );
++ $details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A );
++ $editblog_roles = get_blog_option( $id, "{$wpmuBaseTablePrefix}{$id}_user_roles" );
+ ?>
++ <div class="wrap">
++ <h2><?php _e('Edit Blog'); ?></h2>
++ <a href='http://<?php echo $details['domain'].$details['path']; ?>'><?php echo $details['domain'].$details['path']; ?></a>
++ <form method="post" action="wpmu-edit.php?action=updateblog">
++ <?php wp_nonce_field('editblog'); ?>
++ <input type="hidden" name="id" value="<?php echo $id ?>" />
++ <table>
++ <tr>
++ <td valign="top">
++ <div class="wrap">
++ <table style="border:0; width:100%;" cellspacing="2" cellpadding="5" class="editform">
++ <tr valign="top">
++ <th scope="row"><?php _e('URL') ?></th>
++ <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details['domain'] ?>" size="33" /></td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e('Path') ?></th>
++ <td><input name="blog[path]" type="text" id="path" value="<?php echo $details['path'] ?>" size="40" /></td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e('Registered') ?></th>
++ <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details['registered'] ?>" size="40" /></td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e('Last Updated') ?></th>
++ <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details['last_updated'] ?>" size="40" /></td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e('Public') ?></th>
++ <td>
++ <input type='radio' name='blog[public]' value='1' <?php if( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
++ <input type='radio' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
++ </td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e( 'Archived' ); ?></th>
++ <td>
++ <input type='radio' name='blog[archived]' value='1' <?php if( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
++ <input type='radio' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
++ </td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e( 'Mature' ); ?></th>
++ <td>
++ <input type='radio' name='blog[mature]' value='1' <?php if( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
++ <input type='radio' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
++ </td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e( 'Spam' ); ?></th>
++ <td>
++ <input type='radio' name='blog[spam]' value='1' <?php if( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
++ <input type='radio' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
++ </td>
++ </tr>
++ <tr valign="top">
++ <th scope="row"><?php _e( 'Deleted' ); ?></th>
++ <td>
++ <input type='radio' name='blog[deleted]' value='1' <?php if( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
++ <input type='radio' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
++ </td>
++ </tr>
++ <tr>
++ <td colspan="2"><br /><br /></td>
++ </tr>
++ <?php
++ $editblog_default_role = 'subscriber';
++ foreach ( $options as $key => $val ) {
++ if( $val['option_name'] == 'default_role' ) {
++ $editblog_default_role = $val['option_value'];
++ }
++ $disabled = '';
++ if ( is_serialized($val['option_value']) ) {
++ if ( is_serialized_string($val['option_value']) ) {
++ $val['option_value'] = wp_specialchars(maybe_unserialize($val['option_value']), 'single');
++ } else {
++ $val['option_value'] = "SERIALIZED DATA";
++ $disabled = ' disabled="disabled"';
++ }
++ }
++ if ( stristr($val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) {
++ ?>
++ <tr valign="top">
++ <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
++ <td><textarea rows="5" cols="40" name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>"<?php echo $disabled ?>><?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?></textarea></td>
++ </tr>
++ <?php
++ } else {
++ ?>
++ <tr valign="top">
++ <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
++ <td><input name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>" value="<?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?>" size="40" <?php echo $disabled ?> /></td>
++ </tr>
++ <?php
++ }
++ } // End foreach
++ ?>
++ </table>
++ <p class="submit">
++ <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
++ </div>
++ </td>
++ <td valign="top">
++ <?php
++ // Blog Themes
++ $themes = get_themes();
++ $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
++ $allowed_themes = get_site_option( "allowedthemes" );
++ if( $allowed_themes == false ) {
++ $allowed_themes = array_keys( $themes );
++ }
++ $out = '';
++ foreach( $themes as $key => $theme ) {
++ $theme_key = wp_specialchars( $theme['Stylesheet'] );
++ if( isset($allowed_themes[$theme_key] ) == false ) {
++ $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
++ $out .= '<tr valign="top">
++ <th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th>
++ <td><input name="theme['.$theme_key.']" type="checkbox" value="on" '.$checked.'/></td>
++ </tr>';
++ }
++ }
++
++ if( $out != '' ) {
++ echo "<div class='wrap'><h3>" . __('Blog Themes') . "</h3>";
++ echo '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">';
++ echo '<tr><th>' . __('Theme') . '</th><th>' . __('Enable') . '</th></tr>';
++ echo $out;
++ echo "</table></div>";
++ }
++
++ // Blog users
++ $blogusers = get_users_of_blog( $id );
++ echo '<div class="wrap"><h3>' . __('Blog Users') . '</h3>';
++ if( is_array( $blogusers ) ) {
++ echo '<table width="100%"><caption>' . __('Current Users') . '</caption>';
++ echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th><th></th></tr>";
++ reset($blogusers);
++ foreach ( (array) $blogusers as $key => $val ) {
++ $t = @unserialize( $val->meta_value );
++ if( is_array( $t ) ) {
++ reset( $t );
++ $existing_role = key( $t );
++ }
++ echo "<tr><td>" . $val->user_login . "</td>";
++ if( $val->user_id != $current_user->data->ID ) {
++ ?>
++ <td>
++ <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
++ foreach( $editblog_roles as $role => $role_assoc ){
++ $selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
++ echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>";
++ }
++ ?>
++ </select>
++ </td>
++ <td>
++ <input type='text' name='user_password[<?php echo $val->user_id ?>]' />
++ </td>
++ <?php
++ echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']" /></td>';
++ } else {
++ echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>";
++ }
++ echo '<td><a href="user-edit.php?user_id=' . $val->user_id . '">' . __('Edit') . "</a></td></tr>";
++ }
++ echo "</table>";
++ }
++
++ // New blog user
++ echo "<h3>" . __('Add a new user') . "</h3>";
++ ?>
++ <p><?php _e('As you type WordPress will offer you a choice of usernames.<br /> Click them to select and hit <em>Update Options</em> to add the user.') ?></p>
++ <table>
++ <tr>
++ <th scope="row"><?php _e('User&nbsp;Login:') ?></th>
++ <td><input type="text" name="newuser" id="newuser" /></td>
++ </tr>
++ <tr>
++ <th scope="row"><?php _e('Role:') ?></th>
++ <td>
++ <select name="new_role" id="new_role">
++ <?php
++ reset( $editblog_roles );
++ foreach( $editblog_roles as $role => $role_assoc ){
++ $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
++ echo "<option {$selected} value=\"{$role}\">{$role_assoc['name']}</option>";
++ }
++ ?>
++ </select>
++ </td>
++ </tr>
++ </table>
++ </div>
++
++ <div class="wrap">
++ <strong><?php _e('Misc Blog Actions') ?></strong>
++ <p><?php do_action( 'wpmueditblogaction', $id ); ?></p>
++ </div>
++
++ <p class="submit">
++ <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
++ </td>
++ </tr>
++ </table>
++ </form>
++ </div>
+ <?php
++ break;
++
++ // List blogs
++ default:
++ $start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0;
++ $num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 60;
++
++ $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
++
++ if( !empty($_GET['s']) ) {
++ $s = trim($_GET['s']);
+ $query = "SELECT blog_id, {$wpdb->blogs}.domain, {$wpdb->blogs}.path, registered, last_updated
++ FROM {$wpdb->blogs}, {$wpdb->site}
++ WHERE site_id = '{$wpdb->siteid}'
++ AND {$wpdb->blogs}.site_id = {$wpdb->site}.id
++ AND ( {$wpdb->blogs}.domain LIKE '%{$s}%' OR {$wpdb->blogs}.path LIKE '%{$s}%' )";
++ } elseif( !empty($_GET['blog_id']) ) {
+ $query = "SELECT *
++ FROM {$wpdb->blogs}
++ WHERE site_id = '{$wpdb->siteid}'
++ AND blog_id = '".intval($_GET['blog_id'])."'";
++ } elseif( !empty($_GET['ip_address']) ) {
++ $query = "SELECT *
++ FROM {$wpdb->blogs}, {$wpdb->registration_log}
++ WHERE site_id = '{$wpdb->siteid}'
++ AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
++ AND {$wpdb->registration_log}.IP LIKE ('%".$_GET['ip_address']."%')";
+ }
++
++ if( isset( $_GET['sortby'] ) == false ) {
++ $_GET['sortby'] = 'id';
+ }
++
++ if( $_GET['sortby'] == 'registered' ) {
+ $query .= ' ORDER BY registered ';
++ } elseif( $_GET['sortby'] == 'id' ) {
+ $query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
++ } elseif( $_GET['sortby'] == 'lastupdated' ) {
+ $query .= ' ORDER BY last_updated ';
++ } elseif( $_GET['sortby'] == 'blogname' ) {
+ $query .= ' ORDER BY domain ';
+ }
++
++ $query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
++
++ if ( $_GET['ip_address'] == '' ) {
++ $query .= " LIMIT " . intval( $start ) . ", " . intval( $num );
+ }
++
++ $blog_list = $wpdb->get_results( $query, ARRAY_A );
++
++ $next = ( count( $blog_list ) < $num ) ? false : true;
++
++ // Pagination
++ $url2 = "order=" . $_GET['order'] . "&amp;sortby=" . $_GET['sortby'] . "&amp;s=" . $_GET['s'] . "&ip_address=" . $_GET['ip_address'];
+
++ $blog_navigation = '';
++ if( $start == 0 ) {
++ $blog_navigation .= __('Previous&nbsp;Blogs');
++ } elseif( $start <= 30 ) {
++ $blog_navigation .= '<a href="wpmu-blogs.php?start=0&amp;' . $url2 . ' ">' . __('Previous&nbsp;Blogs') . '</a>';
+ } else {
++ $blog_navigation .= '<a href="wpmu-blogs.php?start=' . ( $start - $num ) . '&' . $url2 . '">' . __('Previous&nbsp;Blogs') . '</a>';
++ }
++ if ( $next ) {
++ $blog_navigation .= '&nbsp;||&nbsp;<a href="wpmu-blogs.php?start=' . ( $start + $num ) . '&' . $url2 . '">' . __('Next&nbsp;Blogs') . '</a>';
++ } else {
++ $blog_navigation .= '&nbsp;||&nbsp;' . __('Next&nbsp;Blogs');
+ }
++ ?>
++ <script type="text/javascript">
++ <!--
++ var checkflag = "false";
++
++ function check_all_rows() {
++ var button1 = document.getElementById('check_all1');
++ var button2 = document.getElementById('check_all2');
++
++ field = document.formlist;
++ if (checkflag == "false") {
++ for (i = 0; i < field.length; i++) {
++ if( field[i].name == 'allblogs[]' ) {
++ field[i].checked = true;
++ }
++ }
++ checkflag = "true";
++ button1.value = "<?php _e('Uncheck All') ?>";
++ button2.value = "<?php _e('Uncheck All') ?>";
++ } else {
++ for (i = 0; i < field.length; i++) {
++ if( field[i].name == 'allblogs[]' ) {
++ field[i].checked = false;
++ }
++ }
++ checkflag = "false";
++ button1.value = "<?php _e('Check All') ?>";
++ button2.value = "<?php _e('Check All') ?>"
++ }
++ }
++ // -->
++ </script>
++ <div class="wrap">
++ <h2><?php _e('Blogs') ?></h2>
++ <div style="float:right; padding:0 20px; margin-top:20px;">
++ <h4 style="margin:0 0 4px;"><?php _e('Blog Navigation') ?></h4>
++ <?php echo $blog_navigation; ?>
++ </div>
++
++ <form id="searchform" action="wpmu-blogs.php" method="get">
++ <input type="hidden" name="action" value="blogs" />
++ <fieldset>
++ <legend><?php _e('Search blogs by name&hellip;') ?></legend>
++ <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes(wp_specialchars($_GET['s'], 1)); ?>" size="17" />
++ </fieldset>
++
++ <fieldset>
++ <legend><?php _e('by blog ID&hellip;') ?></legend>
++ <input type="text" name="blog_id" value="<?php if (isset($_GET['blog_id'])) echo wp_specialchars($_GET['blog_id'], 1); ?>" size="10" />
++ </fieldset>
++
++ <fieldset>
++ <legend><?php _e('by IP address&hellip;') ?></legend>
++ <input type="text" name="ip_address" value="<?php if (isset($_GET['ip_address'])) echo wp_specialchars($_GET['ip_address'], 1); ?>" size="10" />
++ </fieldset>
++ <input type="submit" name="submit" id="post-query-submit" value="<?php _e('Search') ?>" class="button" />
++ </form>
+
++
++ <br style="clear:both;" />
++
++ <?php if( isset($_GET['s']) && !empty($_GET['s']) ) : ?>
++ <p><a href="wpmu-users.php?action=users&s=<?php echo stripslashes(wp_specialchars($_GET['s'], 1)) ?>"><?php _e('Search Users:') ?> <strong><?php echo stripslashes(wp_specialchars($_GET['s'], 1)); ?></strong></a></p>
++ <?php endif; ?>
++
++ <?php
++ // define the columns to display, the syntax is 'internal name' => 'display name'
++ $posts_columns = array(
++ 'id' => __('ID'),
++ 'blogname' => __('Blog Name'),
++ 'lastupdated' => __('Last Updated'),
++ 'registered' => __('Registered'),
++ 'users' => __('Users'),
++ 'plugins' => __('Actions')
++ );
++ $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+
++ // you can not edit these at the moment
++ $posts_columns['control_view'] = '';
++ $posts_columns['control_edit'] = '';
++ $posts_columns['control_backend'] = '';
++ $posts_columns['control_deactivate']= '';
++ $posts_columns['control_archive'] = '';
++ $posts_columns['control_spam'] = '';
++ $posts_columns['control_delete'] = '';
+
++ $sortby_url = "s=" . $_GET['s'] . "&amp;ip_address=" . $_GET['ip_address'];
++ ?>
++ <form name="formlist" action="wpmu-edit.php?action=allblogs" method="post">
++ <input style="margin:5px 0;" id="check_all1" class="button" type="button" value="<?php _e('Check All') ?>" onclick="check_all_rows()" />
++
++ <table width="100%" cellpadding="3" cellspacing="3" class="widefat">
++ <thead>
++ <tr>
++ <?php foreach($posts_columns as $column_id => $column_display_name) : ?>
++ <th scope="col"><a href="wpmu-blogs.php?<?php echo $sortby_url ?>&amp;sortby=<?php echo $column_id ?>&amp;<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&amp;" ; } else { echo "order=DESC&amp;"; } } ?>start=<?php echo $start ?>"><?php echo $column_display_name; ?></a></th>
++ <?php endforeach ?>
++ </tr>
++ </thead>
++ <tbody id="the-list">
++ <?php
++ if ($blog_list) {
++ $bgcolor = '';
++ $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
++ foreach ($blog_list as $blog) {
++ $class = ('alternate' == $class) ? '' : 'alternate';
++ reset( $status_list );
++
++ $bgcolour = "";
++ foreach ( $status_list as $status => $col ) {
++ if( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
++ $bgcolour = "style='background: $col'";
++ }
++ }
++ echo "<tr $bgcolour class='$class'>";
++
++ $blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
+
++ foreach( $posts_columns as $column_name=>$column_display_name ) {
++ switch($column_name) {
++ case 'id': ?>
++ <th scope="row">
++ <input type='checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo $blog['blog_id'] ?>' /> <label for='blog_<?php echo $blog['blog_id'] ?>'><?php echo $blog['blog_id'] ?></label>
++ </th>
++ <?php
++ break;
+
++ case 'blogname': ?>
++ <td valign="top">
++ <label for='blog_<?php echo $blog['blog_id'] ?>'><?php echo $blogname ?></label>
++ </td>
++ <?php
++ break;
+
++ case 'lastupdated': ?>
++ <td valign="top">
++ <?php echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['last_updated']); ?>
++ </td>
++ <?php
++ break;
+
++ case 'registered': ?>
++ <td valign="top">
++ <?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['registered']); ?>
++ </td>
++ <?php
++ break;
+
++ case 'users': ?>
++ <td valign="top">
++ <?php
++ $blogusers = get_users_of_blog( $blog['blog_id'] );
++ if( is_array( $blogusers ) ) {
++ if( $blog['blog_id'] == 1 && count( $blogusers ) > 10 ) {
++ $blogusers = array_slice( $blogusers, 0, 10 );
++ }
++ foreach ( $blogusers as $key => $val ) {
++ echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />';
++ }
++ }
++ ?>
++ </td>
++ <?php
++ break;
+
++ case 'control_view': ?>
++ <td valign="top">
++ <a href="http://<?php echo $blog['domain']. $blog['path']; ?>" rel="permalink" class="edit"><?php _e('View'); ?></a>
++ </td>
++ <?php
++ break;
+
++ case 'control_edit': ?>
++ <td valign="top">
++ <?php echo "<a href='wpmu-blogs.php?action=editblog&amp;id=".$blog['blog_id']."' class='edit'>" . __('Edit') . "</a>"; ?>
++ </td>
++ <?php
++ break;
+
++ case 'control_backend':
++ ?>
++ <td valign="top">
++ <?php echo "<a href='http://" . $blog['domain'] . $blog['path'] . "wp-admin/' class='edit'>" . __('Backend') . "</a>"; ?>
++ </td>
++ <?php
++ break;
+
++ case 'control_spam':
++ if( get_blog_status( $blog['blog_id'], "spam" ) == '1' ) { ?>
++ <td valign="top">
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=unspamblog&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to mark as not spam this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Not Spam") ?></a>
++ </td>
++ <?php } else { ?>
++ <td valign='top'>
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=spamblog&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to mark as spam this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Spam") ?></a>
++ </td>
++ <?php }
++ break;
+
++ case 'control_deactivate':
++ if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) { ?>
++ <td valign="top">
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=activateblog&amp;ref=<?php echo urlencode( $_SERVER['REQUEST_URI'] ) ?>&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to activate this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Activate") ?></a>
++ </td>
++ <?php } else { ?>
++ <td valign="top">
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=deactivateblog&amp;ref=<?php echo urlencode( $_SERVER['REQUEST_URI'] ) ?>&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to deactive this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Deactivate") ?></a>
++ </td>
++ <?php }
++ break;
+
++ case 'control_archive':
++ if( get_blog_status( $blog['blog_id'], "archived" ) == '1' ) { ?>
++ <td valign="top">
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to unarchive this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Unarchive") ?></a>
++ </td>
++ <?php } else { ?>
++ <td valign="top">
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=archiveblog&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to archive this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Archive") ?></a>
++ </td>
++ <?php }
++ break;
+
++ case 'control_delete': ?>
++ <td valign="top">
++ <a class='delete' href="wpmu-edit.php?action=confirm&amp;action2=deleteblog&amp;id=<?php echo $blog['blog_id'] ?>&amp;msg=<?php echo urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) ?>" onclick="return deleteSomething( 'blog', <?php echo $blog['blog_id']; ?>, '<?php echo js_escape(sprintf(__("You are about to delete this blog '%s'.\n'OK' to delete, 'Cancel' to stop."), $blogname)); ?>' );"><?php _e("Delete") ?></a>
++ </td>
++ <?php break;
+
++ case 'plugins': ?>
++ <td valign="top">
++ <?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>
++ </td>
++ <?php break;
+
++ default: ?>
++ <td valign="top">
++ <?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>
++ </td>
++ <?php break;
++ }
++ }
++ ?>
++ </tr>
++ <?php
++ }
++ } else { ?>
++ <tr style='background-color: <?php echo $bgcolor; ?>'>
++ <td colspan="8"><?php _e('No blogs found.') ?></td>
++ </tr>
+ <?php
++ } // end if ($blogs)
+ ?>
++ </tbody>
++ </table>
++
++ <div style="float:right; padding:0 20px; margin-top:20px;">
++ <h4 style="margin:0 0 4px;"><?php _e('Blog Navigation') ?></h4>
++ <?php echo $blog_navigation;?>
++ </div>
+
++ <input style="margin:5px 0;" id="check_all2" type="button" class="button" value="<?php _e('Check All') ?>" onclick="check_all_rows()" />
++
++ <h3><?php _e('Update selected blogs:') ?></h3>
++ <ul style="list-style:none;">
++ <li><input type='radio' name='blogfunction' id='delete' value='delete' /> <label for='delete'><?php _e('Delete') ?></label></li>
++ <li><input type='radio' name='blogfunction' id='spam' value='spam' /> <label for='spam'><?php _e('Mark as Spam') ?></label></li>
++ </ul>
++
++ <p class="submit" style="width: 220px">
++ <?php wp_nonce_field( "allblogs" ); ?>
++ <input type='hidden' name='redirect' value='<?php echo $_SERVER['REQUEST_URI'] ?>' />
++ <input type='submit' class="button" value='<?php _e('Apply Changes') ?>' /></p>
++ </form>
++ </div>
++
++ <div class="wrap">
++ <h2><?php _e('Add Blog') ?></h2>
++ <form method="post" action="wpmu-edit.php?action=addblog">
++ <?php wp_nonce_field('add-blog') ?>
++ <table cellpadding="3" cellspacing="3">
++ <tr>
++ <th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th>
++ <td>
++ <?php if( constant( "VHOST" ) == 'yes' ) : ?>
++ <input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
++ <?php else:
++ echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>
++ <?php endif; ?>
++ </td>
++ </tr>
++ <tr><th style="text-align:center;" scope='row'><?php _e('Blog Title') ?></th><td><input name="blog[title]" type="text" size="20" title="<?php _e('Title') ?>"/></td></tr>
++ <tr><th style="text-align:center;" scope='row'><?php _e('Admin Email') ?></th><td><input name="blog[email]" type="text" size="20" title="<?php _e('Email') ?>"/></td></tr>
++ <tr><td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?></td></tr>
++ </table>
++ <input class="button" type="submit" name="go" value="<?php _e('Add Blog') ?>" />
++ </form>
++ </div>
+ <?php
++ break;
+ } // end switch( $action )
+
++ include('admin-footer.php'); ?> \ No newline at end of file
diff --git a/wp-content/themes/default/attachment.php b/wp-content/themes/default/image.php
index 779af0d..d8e36fd 100644
--- a/wp-content/themes/default/attachment.php
+++ b/wp-content/themes/default/image.php
@@ -4,31 +4,26 @@
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <div class="navigation">
- <div class="alignleft">&nbsp;</div>
- <div class="alignright">&nbsp;</div>
- </div>
-<?php $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800)); // This also populates the iconsize for the next line ?>
-<?php $_post = &get_post($post->ID); $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment'; // This lets us style narrow icons specially ?>
<div class="post" id="post-<?php the_ID(); ?>">
- <h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
+ <h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2>
<div class="entry">
- <p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
+ <p class="attachment"><?php echo wp_get_attachment_link(0, 'medium', false); ?></p>
<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
+ <div class="navigation">
+ <div class="alignleft"><?php previous_image_link() ?></div>
+ <div class="alignright"><?php next_image_link() ?></div>
+ </div>
+ <br class="clear" />
+
<p class="postmetadata alt">
<small>
- This entry was posted
- <?php /* This is commented, because it requires a little adjusting sometimes.
- You'll need to download this plugin, and follow the instructions:
- http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
- /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
- on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
+ This entry was posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>.
- You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
+ You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?>
@@ -52,6 +47,7 @@
</p>
</div>
+
</div>
<?php comments_template(); ?>
diff --git a/wp-includes/class-phpass.php b/wp-includes/class-phpass.php
new file mode 100644
index 0000000..656caa3
--- /dev/null
+++ b/wp-includes/class-phpass.php
@@ -0,0 +1,256 @@
+<?php
+/**
+ * Portable PHP password hashing framework.
+ * @package phpass
+ * @since 2.5
+ * @version 0.1
+ * @link http://www.openwall.com/phpass/
+ */
+
+#
+# Portable PHP password hashing framework.
+#
+# Version 0.1 / genuine.
+#
+# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
+# the public domain.
+#
+# There's absolutely no warranty.
+#
+# The homepage URL for this framework is:
+#
+# http://www.openwall.com/phpass/
+#
+# Please be sure to update the Version line if you edit this file in any way.
+# It is suggested that you leave the main version number intact, but indicate
+# your project name (after the slash) and add your own revision information.
+#
+# Please do not change the "private" password hashing method implemented in
+# here, thereby making your hashes incompatible. However, if you must, please
+# change the hash type identifier (the "$P$") to something different.
+#
+# Obviously, since this code is in the public domain, the above are not
+# requirements (there can be none), but merely suggestions.
+#
+class PasswordHash {
+ var $itoa64;
+ var $iteration_count_log2;
+ var $portable_hashes;
+ var $random_state;
+
+ function PasswordHash($iteration_count_log2, $portable_hashes)
+ {
+ $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+
+ if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
+ $iteration_count_log2 = 8;
+ $this->iteration_count_log2 = $iteration_count_log2;
+
+ $this->portable_hashes = $portable_hashes;
+
+ $this->random_state = microtime() . getmypid();
+ }
+
+ function get_random_bytes($count)
+ {
+ $output = '';
+ if (($fh = @fopen('/dev/urandom', 'rb'))) {
+ $output = fread($fh, $count);
+ fclose($fh);
+ }
+
+ if (strlen($output) < $count) {
+ $output = '';
+ for ($i = 0; $i < $count; $i += 16) {
+ $this->random_state =
+ md5(microtime() . $this->random_state);
+ $output .=
+ pack('H*', md5($this->random_state));
+ }
+ $output = substr($output, 0, $count);
+ }
+
+ return $output;
+ }
+
+ function encode64($input, $count)
+ {
+ $output = '';
+ $i = 0;
+ do {
+ $value = ord($input[$i++]);
+ $output .= $this->itoa64[$value & 0x3f];
+ if ($i < $count)
+ $value |= ord($input[$i]) << 8;
+ $output .= $this->itoa64[($value >> 6) & 0x3f];
+ if ($i++ >= $count)
+ break;
+ if ($i < $count)
+ $value |= ord($input[$i]) << 16;
+ $output .= $this->itoa64[($value >> 12) & 0x3f];
+ if ($i++ >= $count)
+ break;
+ $output .= $this->itoa64[($value >> 18) & 0x3f];
+ } while ($i < $count);
+
+ return $output;
+ }
+
+ function gensalt_private($input)
+ {
+ $output = '$P$';
+ $output .= $this->itoa64[min($this->iteration_count_log2 +
+ ((PHP_VERSION >= '5') ? 5 : 3), 30)];
+ $output .= $this->encode64($input, 6);
+
+ return $output;
+ }
+
+ function crypt_private($password, $setting)
+ {
+ $output = '*0';
+ if (substr($setting, 0, 2) == $output)
+ $output = '*1';
+
+ if (substr($setting, 0, 3) != '$P$')
+ return $output;
+
+ $count_log2 = strpos($this->itoa64, $setting[3]);
+ if ($count_log2 < 7 || $count_log2 > 30)
+ return $output;
+
+ $count = 1 << $count_log2;
+
+ $salt = substr($setting, 4, 8);
+ if (strlen($salt) != 8)
+ return $output;
+
+ # We're kind of forced to use MD5 here since it's the only
+ # cryptographic primitive available in all versions of PHP
+ # currently in use. To implement our own low-level crypto
+ # in PHP would result in much worse performance and
+ # consequently in lower iteration counts and hashes that are
+ # quicker to crack (by non-PHP code).
+ if (PHP_VERSION >= '5') {
+ $hash = md5($salt . $password, TRUE);
+ do {
+ $hash = md5($hash . $password, TRUE);
+ } while (--$count);
+ } else {
+ $hash = pack('H*', md5($salt . $password));
+ do {
+ $hash = pack('H*', md5($hash . $password));
+ } while (--$count);
+ }
+
+ $output = substr($setting, 0, 12);
+ $output .= $this->encode64($hash, 16);
+
+ return $output;
+ }
+
+ function gensalt_extended($input)
+ {
+ $count_log2 = min($this->iteration_count_log2 + 8, 24);
+ # This should be odd to not reveal weak DES keys, and the
+ # maximum valid value is (2**24 - 1) which is odd anyway.
+ $count = (1 << $count_log2) - 1;
+
+ $output = '_';
+ $output .= $this->itoa64[$count & 0x3f];
+ $output .= $this->itoa64[($count >> 6) & 0x3f];
+ $output .= $this->itoa64[($count >> 12) & 0x3f];
+ $output .= $this->itoa64[($count >> 18) & 0x3f];
+
+ $output .= $this->encode64($input, 3);
+
+ return $output;
+ }
+
+ function gensalt_blowfish($input)
+ {
+ # This one needs to use a different order of characters and a
+ # different encoding scheme from the one in encode64() above.
+ # We care because the last character in our encoded string will
+ # only represent 2 bits. While two known implementations of
+ # bcrypt will happily accept and correct a salt string which
+ # has the 4 unused bits set to non-zero, we do not want to take
+ # chances and we also do not want to waste an additional byte
+ # of entropy.
+ $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+
+ $output = '$2a$';
+ $output .= chr(ord('0') + $this->iteration_count_log2 / 10);
+ $output .= chr(ord('0') + $this->iteration_count_log2 % 10);
+ $output .= '$';
+
+ $i = 0;
+ do {
+ $c1 = ord($input[$i++]);
+ $output .= $itoa64[$c1 >> 2];
+ $c1 = ($c1 & 0x03) << 4;
+ if ($i >= 16) {
+ $output .= $itoa64[$c1];
+ break;
+ }
+
+ $c2 = ord($input[$i++]);
+ $c1 |= $c2 >> 4;
+ $output .= $itoa64[$c1];
+ $c1 = ($c2 & 0x0f) << 2;
+
+ $c2 = ord($input[$i++]);
+ $c1 |= $c2 >> 6;
+ $output .= $itoa64[$c1];
+ $output .= $itoa64[$c2 & 0x3f];
+ } while (1);
+
+ return $output;
+ }
+
+ function HashPassword($password)
+ {
+ $random = '';
+
+ if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
+ $random = $this->get_random_bytes(16);
+ $hash =
+ crypt($password, $this->gensalt_blowfish($random));
+ if (strlen($hash) == 60)
+ return $hash;
+ }
+
+ if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
+ if (strlen($random) < 3)
+ $random = $this->get_random_bytes(3);
+ $hash =
+ crypt($password, $this->gensalt_extended($random));
+ if (strlen($hash) == 20)
+ return $hash;
+ }
+
+ if (strlen($random) < 6)
+ $random = $this->get_random_bytes(6);
+ $hash =
+ $this->crypt_private($password,
+ $this->gensalt_private($random));
+ if (strlen($hash) == 34)
+ return $hash;
+
+ # Returning '*' on error is safe here, but would _not_ be safe
+ # in a crypt(3)-like function used _both_ for generating new
+ # hashes and for validating passwords against existing hashes.
+ return '*';
+ }
+
+ function CheckPassword($password, $stored_hash)
+ {
+ $hash = $this->crypt_private($password, $stored_hash);
+ if ($hash[0] == '*')
+ $hash = crypt($password, $stored_hash);
+
+ return $hash == $stored_hash;
+ }
+}
+
+?>
diff --git a/wp-includes/images/audio.png b/wp-includes/images/audio.png
new file mode 100644
index 0000000..7b2a854
--- /dev/null
+++ b/wp-includes/images/audio.png
Binary files differ
diff --git a/wp-includes/images/crystal/archive.png b/wp-includes/images/crystal/archive.png
new file mode 100644
index 0000000..670648a
--- /dev/null
+++ b/wp-includes/images/crystal/archive.png
Binary files differ
diff --git a/wp-includes/images/crystal/audio.png b/wp-includes/images/crystal/audio.png
new file mode 100644
index 0000000..5a3d4d3
--- /dev/null
+++ b/wp-includes/images/crystal/audio.png
Binary files differ
diff --git a/wp-includes/images/crystal/code.png b/wp-includes/images/crystal/code.png
new file mode 100644
index 0000000..b67c600
--- /dev/null
+++ b/wp-includes/images/crystal/code.png
Binary files differ
diff --git a/wp-includes/images/crystal/default.png b/wp-includes/images/crystal/default.png
new file mode 100644
index 0000000..b1bbbc7
--- /dev/null
+++ b/wp-includes/images/crystal/default.png
Binary files differ
diff --git a/wp-includes/images/crystal/document.png b/wp-includes/images/crystal/document.png
new file mode 100644
index 0000000..3295ccd
--- /dev/null
+++ b/wp-includes/images/crystal/document.png
Binary files differ
diff --git a/wp-includes/images/crystal/interactive.png b/wp-includes/images/crystal/interactive.png
new file mode 100644
index 0000000..fd6de7d
--- /dev/null
+++ b/wp-includes/images/crystal/interactive.png
Binary files differ
diff --git a/wp-includes/images/crystal/license.txt b/wp-includes/images/crystal/license.txt
new file mode 100644
index 0000000..cdabd2f
--- /dev/null
+++ b/wp-includes/images/crystal/license.txt
@@ -0,0 +1,9 @@
+Crystal Project Icons
+by Everaldo Coelho
+http://everaldo.com
+
+Released under LGPL
+
+Modified February 2008
+for WordPress
+http://wordpress.org \ No newline at end of file
diff --git a/wp-includes/images/crystal/spreadsheet.png b/wp-includes/images/crystal/spreadsheet.png
new file mode 100644
index 0000000..f2c4d30
--- /dev/null
+++ b/wp-includes/images/crystal/spreadsheet.png
Binary files differ
diff --git a/wp-includes/images/crystal/text.png b/wp-includes/images/crystal/text.png
new file mode 100644
index 0000000..feaed5b
--- /dev/null
+++ b/wp-includes/images/crystal/text.png
Binary files differ
diff --git a/wp-includes/images/crystal/video.png b/wp-includes/images/crystal/video.png
new file mode 100644
index 0000000..e1b879d
--- /dev/null
+++ b/wp-includes/images/crystal/video.png
Binary files differ
diff --git a/wp-includes/images/css.png b/wp-includes/images/css.png
new file mode 100644
index 0000000..038e34d
--- /dev/null
+++ b/wp-includes/images/css.png
Binary files differ
diff --git a/wp-includes/images/default.png b/wp-includes/images/default.png
new file mode 100644
index 0000000..c551227
--- /dev/null
+++ b/wp-includes/images/default.png
Binary files differ
diff --git a/wp-includes/images/doc.png b/wp-includes/images/doc.png
new file mode 100644
index 0000000..e4e62a1
--- /dev/null
+++ b/wp-includes/images/doc.png
Binary files differ
diff --git a/wp-includes/images/exe.png b/wp-includes/images/exe.png
new file mode 100644
index 0000000..d994265
--- /dev/null
+++ b/wp-includes/images/exe.png
Binary files differ
diff --git a/wp-includes/images/html.png b/wp-includes/images/html.png
new file mode 100644
index 0000000..ed81af1
--- /dev/null
+++ b/wp-includes/images/html.png
Binary files differ
diff --git a/wp-includes/images/js.png b/wp-includes/images/js.png
new file mode 100644
index 0000000..e0862d3
--- /dev/null
+++ b/wp-includes/images/js.png
Binary files differ
diff --git a/wp-includes/images/pdf.png b/wp-includes/images/pdf.png
new file mode 100644
index 0000000..b4d5f9c
--- /dev/null
+++ b/wp-includes/images/pdf.png
Binary files differ
diff --git a/wp-includes/images/swf.png b/wp-includes/images/swf.png
new file mode 100644
index 0000000..156e3e4
--- /dev/null
+++ b/wp-includes/images/swf.png
Binary files differ
diff --git a/wp-includes/images/tar.png b/wp-includes/images/tar.png
new file mode 100644
index 0000000..0468ef8
--- /dev/null
+++ b/wp-includes/images/tar.png
Binary files differ
diff --git a/wp-includes/images/text.png b/wp-includes/images/text.png
new file mode 100644
index 0000000..10bcf5e
--- /dev/null
+++ b/wp-includes/images/text.png
Binary files differ
diff --git a/wp-includes/images/video.png b/wp-includes/images/video.png
new file mode 100644
index 0000000..f822ac4
--- /dev/null
+++ b/wp-includes/images/video.png
Binary files differ
diff --git a/wp-includes/images/zip.png b/wp-includes/images/zip.png
new file mode 100644
index 0000000..d1eaf1e
--- /dev/null
+++ b/wp-includes/images/zip.png
Binary files differ
diff --git a/wp-includes/js/dbx.js b/wp-includes/js/dbx.js
deleted file mode 100644
index 8e89c5a..0000000
--- a/wp-includes/js/dbx.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// DBX2.05 :: Docking Boxes (dbx)
-// *****************************************************
-// DOM scripting by brothercake -- http://www.brothercake.com/
-// GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html
-//******************************************************
-var dbx;function dbxManager(sid){dbx = this;if(!/^[-_a-z0-9]+$/i.test(sid)) { alert('Error from dbxManager:\n"' + sid + '" is an invalid session ID'); return; }this.supported = !(document.getElementsByTagName('*').length == 0 || (navigator.vendor == 'KDE' && typeof window.sidebar == 'undefined'));if(!this.supported) { return; }this.etype = typeof document.addEventListener != 'undefined' ? 'addEventListener' : typeof document.attachEvent != 'undefined' ? 'attachEvent' : 'none';this.eprefix = (this.etype == 'attachEvent' ? 'on' : '');if(typeof window.opera != 'undefined' && parseFloat(navigator.userAgent.toLowerCase().split(/opera[\/ ]/)[1].split(' ')[0], 10) < 7.5){this.etype = 'none';}if(this.etype == 'none') { this.supported = false; return; }this.running = 0;this.sid = sid;this.savedata = {};this.cookiestate = this.getCookieState();};dbxManager.prototype.setCookieState = function(){var now = new Date();now.setTime(now.getTime() + (365*24*60*60*1000));var str = '';for(j in this.savedata){if(typeof this.savedata[j]!='function'){str += j + '=' + this.savedata[j] + '&'}}this.state = str.replace(/^(.+)&$/, '$1');this.cookiestring = this.state.replace(/,/g, '|');this.cookiestring = this.cookiestring.replace(/=/g, ':');if(typeof this.onstatechange == 'undefined' || this.onstatechange()){document.cookie = 'dbx-' + this.sid + '='+ this.cookiestring+ '; expires=' + now.toGMTString()+ '; path=/';}};dbxManager.prototype.getCookieState = function(){this.cookiestate = null;if(document.cookie){if(document.cookie.indexOf('dbx-' + this.sid)!=-1){this.cookie = document.cookie.split('dbx-' + this.sid + '=')[1].split(';')[0].split('&');for(var i in this.cookie){if(typeof this.cookie[i]!='function'){this.cookie[i] = this.cookie[i].replace(/\|/g, ',');this.cookie[i]= this.cookie[i].replace(/:/g, '=');this.cookie[i] = this.cookie[i].split('=');this.cookie[i][1] = this.cookie[i][1].split(',');}}this.cookiestate = {};for(i in this.cookie){if(typeof this.cookie[i]!='function'){this.cookiestate[this.cookie[i][0]] = this.cookie[i][1];}}}}return this.cookiestate;};dbxManager.prototype.addDataMember = function(gid, order){this.savedata[gid] = order;};dbxManager.prototype.createElement = function(tag){return typeof document.createElementNS != 'undefined' ? document.createElementNS('http://www.w3.org/1999/xhtml', tag) : document.createElement(tag);};dbxManager.prototype.getTarget = function(e, pattern, node){if(typeof node != 'undefined'){var target = node;}else{target = typeof e.target != 'undefined' ? e.target : e.srcElement;}var regex = new RegExp(pattern, '');while(!regex.test(target.className)){target = target.parentNode;}return target;};function dbxGroup(gid, dir, thresh, fix, ani, togs, def, open, close, move, toggle, kmove, ktoggle, syntax){if(!/^[-_a-z0-9]+$/i.test(gid)) { alert('Error from dbxGroup:\n"' + gid + '" is an invalid container ID'); return; }this.container = document.getElementById(gid);if(this.container == null || !dbx.supported) { return; }var self = this;this.gid = gid;this.dragok = false;this.box = null;this.vertical = dir == 'vertical';this.threshold = parseInt(thresh, 10);this.restrict = fix == 'yes';this.resolution = parseInt(ani, 10);this.toggles = togs == 'yes';this.defopen = def != 'closed';this.vocab = {'open' : open,'close' : close,'move' : move,'toggle' : toggle,'kmove' : kmove,'ktoggle' : ktoggle,'syntax' : syntax};this.container.style.position = 'relative';this.container.style.display = 'block';if(typeof window.opera != 'undefined'){this.container.style.display = 'run-in';}this.boxes = [];this.buttons = [];this.order = [];this.eles = this.container.getElementsByTagName('*');for(var i=0; i<this.eles.length; i++){if(/dbx\-box/i.test(this.eles[i].className) && !/dbx\-dummy/i.test(this.eles[i].className)){this.eles[i].style.position = 'relative';this.eles[i].style.display = 'block';this.boxes.push(this.eles[i]);this.eles[i].className += ' dbx-box-open';this.eles[i].className += ' dbxid' + this.order.length;this.order.push(this.order.length.toString() + '+');this.eles[i][dbx.etype](dbx.eprefix + 'mousedown', function(e){if(!e) { e = window.event; }self.mousedown(e, dbx.getTarget(e, 'dbx\-box'));}, false);}if(/dbx\-handle/i.test(this.eles[i].className)){this.eles[i].style.position = 'relative';this.eles[i].style.display = 'block';this.eles[i].className += ' dbx-handle-cursor';this.eles[i].setAttribute('title', this.eles[i].getAttribute('title') == null || this.eles[i].title == '' ? this.vocab.move : this.vocab.syntax.replace('%mytitle%', this.eles[i].title).replace('%dbxtitle%', this.vocab.move));if(this.toggles){this.buttons.push(this.addToggleBehavior(this.eles[i]));}else{this.eles[i][dbx.etype](dbx.eprefix + 'key' + (typeof document.uniqueID != 'undefined' || navigator.vendor == 'Apple Computer, Inc.' ? 'down' : 'press'), function(e){if(!e) { e = window.event; }return self.keypress(e, dbx.getTarget(e, 'dbx\-handle'));}, false);this.eles[i][dbx.etype](dbx.eprefix + 'focus', function(e){if(!e) { e = window.event; }self.createTooltip(null, dbx.getTarget(e, 'dbx\-handle'));}, false);this.eles[i][dbx.etype](dbx.eprefix + 'blur', function(){self.removeTooltip();}, false);}}}dbx.addDataMember(this.gid, this.order.join(','));var dummy = this.container.appendChild(dbx.createElement('span'));dummy.className = 'dbx-box dbx-dummy';dummy.style.display = 'block';dummy.style.width = '0';dummy.style.height = '0';dummy.style.overflow = 'hidden';if(this.vertical) { dummy.className += ' dbx-offdummy'; }this.boxes.push(dummy);if(dbx.cookiestate != null && typeof dbx.cookiestate[this.gid] != 'undefined'){var num = dbx.cookiestate[this.gid].length;if(num == this.boxes.length - 1){for(i=0; i<num; i++){var index = parseInt(dbx.cookiestate[this.gid][i], 10);this.container.insertBefore(this.boxes[index], dummy);if(this.toggles && /\-$/.test(dbx.cookiestate[this.gid][i])){this.toggleBoxState(this.buttons[index], false);}}this.getBoxOrder();}}else if(!this.defopen && this.toggles){var len = this.buttons.length;for(i=0; i<len; i++){this.toggleBoxState(this.buttons[i], true);}}document[dbx.etype](dbx.eprefix + 'mouseout', function(e){if(typeof e.target == 'undefined') { e = window.event; e.relatedTarget = e.toElement; }if(e.relatedTarget == null){self.mouseup(e);}}, false);document[dbx.etype](dbx.eprefix + 'mousemove', function(e){self.mousemove(e);return !self.dragok;}, false);document[dbx.etype](dbx.eprefix + 'mouseup', function(e){self.mouseup(e);}, false);this.keydown = false;document[dbx.etype](dbx.eprefix + 'keydown', function(){self.keydown = true;}, false);document[dbx.etype](dbx.eprefix + 'keyup', function(){self.keydown = false;}, false);};dbxGroup.prototype.addToggleBehavior = function(){var self = this;var button = arguments[0].appendChild(dbx.createElement('a'));button.appendChild(document.createTextNode('\u00a0'));button.style.cursor = 'pointer';button.href = 'javascript:void(null)';button.className = 'dbx-toggle dbx-toggle-open';button.setAttribute('title', this.vocab.toggle.replace('%toggle%', this.vocab.close));button.hasfocus = typeof window.opera != 'undefined' || navigator.vendor == 'Apple Computer, Inc.' ? null : false;this.tooltip = null;button.onclick = function(){if(this.hasfocus === true || this.hasfocus === null){self.removeTooltip();self.toggleBoxState(this, true);}};button['onkey' + (typeof document.uniqueID != 'undefined' || navigator.vendor == 'Apple Computer, Inc.' ? 'down' : 'press')] = function(e){if(!e) { e = window.event; }return self.keypress(e, this);};button.onfocus = function(){var len = self.buttons.length;for(var i=0; i<len; i++){self.buttons[i].className = self.buttons[i].className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/, '');}var isopen = (/dbx\-toggle\-open/.test(this.className));this.className += ' dbx-toggle-hilite-' + (isopen ? 'open' : 'closed');self.createTooltip(isopen, this);this.isactive = true;if(this.hasfocus !== null) { this.hasfocus = true; }};button.onblur = function(){this.className = this.className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/, '');self.removeTooltip();if(this.hasfocus !== null) { this.hasfocus = false; }};return button;};dbxGroup.prototype.toggleBoxState = function(button, regen){var isopen = (/dbx\-toggle\-open/.test(button.className));var parent = dbx.getTarget(null, 'dbx\-box', button);dbx.box = parent;dbx.toggle = button;if(typeof dbx.container == 'undefined'){dbx.group = dbx.getTarget(null, 'dbx\-group', parent);}else { dbx.group = dbx.container; }if((!isopen && (typeof dbx.onboxopen == 'undefined' || dbx.onboxopen()))||(isopen && (typeof dbx.onboxclose == 'undefined' || dbx.onboxclose()))){button.className = 'dbx-toggle dbx-toggle-' + (isopen ? 'closed' : 'open');button.title = this.vocab.toggle.replace('%toggle%', isopen ? this.vocab.open : this.vocab.close);if(typeof button.isactive != 'undefined'){button.className += ' dbx-toggle-hilite-' + (isopen ? 'closed' : 'open')}parent.className = parent.className.replace(/[ ](dbx-box-)(open|closed)/, ' $1' + (isopen ? 'closed' : 'open'));if(regen) { this.getBoxOrder(); }}};dbxGroup.prototype.shiftBoxPosition = function(e, anchor, positive){var parent = dbx.getTarget(null, 'dbx\-box', anchor);dbx.group = this.container;dbx.box = parent;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){var positions = [];var len = this.boxes.length;for(var i=0; i<len; i++){positions[i] = [i, this.boxes[i][this.vertical ? 'offsetTop' : 'offsetLeft']];if(parent == this.boxes[i]) { this.idref = i; }}positions.sort(this.compare);for(i=0; i<len; i++){if(positions[i][0] == this.idref){if((positive && i < len - 2) || (!positive && i > 0)){var sibling = this.boxes[positions[i + (positive ? 1 : -1)][0]];if(this.resolution > 0){var visipos = { 'x' : parent.offsetLeft, 'y' : parent.offsetTop };var siblingpos = { 'x' : sibling.offsetLeft, 'y' : sibling.offsetTop };}var obj = { 'insert' : (positive ? sibling : parent), 'before' : (positive ? parent : sibling) };this.container.insertBefore(obj.insert, obj.before);if(this.resolution > 0){var animators ={'sibling' : new dbxAnimator(this, sibling, siblingpos, this.resolution, true, anchor),'parent' : new dbxAnimator(this, parent, visipos, this.resolution, true, anchor)};}else{anchor.focus();}break;}}}this.getBoxOrder();}};dbxGroup.prototype.compare = function(a, b){return a[1] - b[1];};dbxGroup.prototype.createTooltip = function(isopen, anchor){if(this.keydown){this.tooltip = this.container.appendChild(dbx.createElement('span'));this.tooltip.style.visibility = 'hidden';this.tooltip.className = 'dbx-tooltip';if(isopen != null){this.tooltip.appendChild(document.createTextNode(this.vocab.kmove + this.vocab.ktoggle.replace('%toggle%', isopen ? this.vocab.close : this.vocab.open)));}else{this.tooltip.appendChild(document.createTextNode(this.vocab.kmove));}var parent = dbx.getTarget(null, 'dbx\-box', anchor);this.tooltip.style.left = parent.offsetLeft + 'px';this.tooltip.style.top = parent.offsetTop + 'px';var tooltip = this.tooltip;window.setTimeout(function(){if(tooltip != null) { tooltip.style.visibility = 'visible'; }}, 500);}};dbxGroup.prototype.removeTooltip = function(){if(this.tooltip != null){this.tooltip.parentNode.removeChild(this.tooltip);this.tooltip = null;}};dbxGroup.prototype.mousedown = function(e, box){var node = typeof e.target != 'undefined' ? e.target : e.srcElement;if(node.nodeName == '#text') { node = node.parentNode; }if(!/dbx\-(toggle|box|group)/i.test(node.className)){while(!/dbx\-(handle|box|group)/i.test(node.className)){node = node.parentNode;}}if(/dbx\-handle/i.test(node.className)){this.removeTooltip();this.released = false;this.initial = { 'x' : e.clientX, 'y' : e.clientY };this.current = { 'x' : 0, 'y' : 0 };this.createCloneBox(box);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return false; }}}};dbxGroup.prototype.mousemove = function(e){if(this.dragok && this.box != null){this.positive = this.vertical ? (e.clientY > this.current.y ? true : false) : (e.clientX > this.current.x ? true : false);this.current = { 'x' : e.clientX, 'y' : e.clientY };var overall = { 'x' : this.current.x - this.initial.x, 'y' : this.current.y - this.initial.y };if(((overall.x >= 0 && overall.x <= this.threshold) || (overall.x <= 0 && overall.x >= 0 - this.threshold))&&((overall.y >= 0 && overall.y <= this.threshold) || (overall.y <= 0 && overall.y >= 0 - this.threshold))){this.current.x -= overall.x;this.current.y -= overall.y;}if(this.released || overall.x > this.threshold || overall.x < (0 - this.threshold) || overall.y > this.threshold || overall.y < (0 - this.threshold)){dbx.group = this.container;dbx.box = this.box;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){this.released = true;if(!this.restrict || !this.vertical) { this.boxclone.style.left = (this.current.x - this.difference.x) + 'px'; }if(!this.restrict || this.vertical) { this.boxclone.style.top = (this.current.y - this.difference.y) + 'px'; }this.moveOriginalToPosition(this.current.x, this.current.y);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }}}}return true;};dbxGroup.prototype.mouseup = function(e){if(this.box != null){this.moveOriginalToPosition(e.clientX, e.clientY);this.removeCloneBox();this.getBoxOrder();if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return true; }}}this.dragok = false;};dbxGroup.prototype.keypress = function(e, anchor){if(/^(3[7-9])|(40)$/.test(e.keyCode)){this.removeTooltip();if((this.vertical && /^(38|40)$/.test(e.keyCode)) || (!this.vertical && /^(37|39)$/.test(e.keyCode))){this.shiftBoxPosition(e, anchor, /^[3][78]$/.test(e.keyCode) ? false : true);if(typeof e.preventDefault != 'undefined') { e.preventDefault(); }else { return false; }typeof e.stopPropagation != 'undefined' ? e.stopPropagation() : e.cancelBubble = true;this.keydown = false;}}return true;};dbxGroup.prototype.getBoxOrder = function(){this.order = [];var len = this.eles.length;for(var j=0; j<len; j++){if(/dbx\-box/i.test(this.eles[j].className) && !/dbx\-(clone|dummy)/i.test(this.eles[j].className)){this.order.push(this.eles[j].className.split('dbxid')[1] + (/dbx\-box\-open/i.test(this.eles[j].className) ? '+' : '-'));}}dbx.savedata[this.gid] = this.order.join(',');dbx.setCookieState();};dbxGroup.prototype.createClone = function(){var clone = this.container.appendChild(arguments[0].cloneNode(true));clone.className += ' dbx-clone';clone.style.position = 'absolute';clone.style.visibility = 'hidden';clone.style.zIndex = arguments[1];clone.style.left = arguments[2].x + 'px';clone.style.top = arguments[2].y + 'px';clone.style.width = arguments[0].offsetWidth + 'px';clone.style.height = arguments[0].offsetHeight + 'px';return clone;};dbxGroup.prototype.createCloneBox = function(box){this.box = box;this.position = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.difference = { 'x' : (this.initial.x - this.position.x), 'y' : (this.initial.y - this.position.y) };this.boxclone = this.createClone(this.box, 30000, this.position);this.boxclone.style.cursor = 'move';this.dragok = true;};dbxGroup.prototype.removeCloneBox = function(){this.container.removeChild(this.boxclone);this.box.style.visibility = 'visible';this.box = null;};dbxGroup.prototype.moveOriginalToPosition = function(clientX, clientY){var cloneprops = {'xy' : this.vertical ? clientY - this.difference.y : clientX - this.difference.x,'wh' : this.vertical ? this.boxclone.offsetHeight : this.boxclone.offsetWidth};this.box.style.visibility = 'hidden';this.boxclone.style.visibility = 'visible';var len = this.boxes.length;for(var i=0; i<len; i++){var boxprops = {'xy' : this.vertical ? this.boxes[i].offsetTop : this.boxes[i].offsetLeft,'wh' : this.vertical ? this.boxes[i].offsetHeight : this.boxes[i].offsetWidth};if((this.positive && cloneprops.xy + cloneprops.wh > boxprops.xy && cloneprops.xy < boxprops.xy)||(!this.positive && cloneprops.xy < boxprops.xy && cloneprops.xy + cloneprops.wh > boxprops.xy)){if(this.boxes[i] == this.box) { return; }var sibling = this.box.nextSibling;while(sibling.className == null || !/dbx\-box/.test(sibling.className)){sibling = sibling.nextSibling;}if(this.boxes[i] == sibling) { return; }if(this.resolution > 0){if(this.box[this.vertical ? 'offsetTop' : 'offsetLeft'] < boxprops.xy){var visibox = this.boxes[i].previousSibling;while(visibox.className == null || !/dbx\-box/.test(visibox.className)){visibox = visibox.previousSibling;}}else{visibox = this.boxes[i];}var visipos = { 'x' : visibox.offsetLeft, 'y' : visibox.offsetTop };}var prepos = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.container.insertBefore(this.box, this.boxes[i]);this.initial.x += (this.box.offsetLeft - prepos.x);this.initial.y += (this.box.offsetTop - prepos.y);if(this.resolution > 0 && visibox != this.box){var animator = new dbxAnimator(this, visibox, visipos, this.resolution, false, null);}else{}break;}}};function dbxAnimator(caller, box, pos, res, kbd, anchor){this.caller = caller;this.box = box;this.timer = null;var before = pos[this.caller.vertical ? 'y' : 'x'];var after = this.box[this.caller.vertical ? 'offsetTop' : 'offsetLeft'];if(before != after){if(dbx.running > this.caller.boxes.length - 1) { return; }var clone = this.caller.createClone(this.box, 29999, arguments[2]);clone.style.visibility = 'visible';this.box.style.visibility = 'hidden';this.animateClone(clone,before,after > before ? after - before : 0 - (before - after),this.caller.vertical ? 'top' : 'left',res,kbd,anchor);}};dbxAnimator.prototype.animateClone = function(clone, current, change, dir, res, kbd, anchor){var self = this;var count = 0;dbx.running ++;this.timer = window.setInterval(function(){count ++;current += change / res;clone.style[dir] = current + 'px';if(count == res){window.clearTimeout(self.timer);self.timer = null;dbx.running --;self.caller.container.removeChild(clone);self.box.style.visibility = 'visible';if(kbd){if(anchor != null && anchor.parentNode.style.visibility != 'hidden'){anchor.focus();}else if(self.caller.toggles){var button = self.caller.buttons[parseInt(self.box.className.split('dbxid')[1],10)];if(button != null && typeof button.isactive != 'undefined'){button.focus();}}}}}, 20);};if(typeof window.attachEvent != 'undefined'){window.attachEvent('onunload', function(){var ev = ['mousedown', 'mousemove', 'mouseup', 'mouseout', 'click', 'keydown', 'keyup', 'focus', 'blur', 'selectstart', 'statechange', 'boxdrag', 'boxopen', 'boxclose'];var el = ev.length;var dl = document.all.length;for(var i=0; i<dl; i++){for(var j=0; j<el; j++){document.all[i]['on' + ev[j]] = null;}}});} \ No newline at end of file
diff --git a/wp-includes/js/fat.js b/wp-includes/js/fat.js
deleted file mode 100644
index 01f1b42..0000000
--- a/wp-includes/js/fat.js
+++ /dev/null
@@ -1,90 +0,0 @@
-// @name The Fade Anything Technique
-// @namespace http://www.axentric.com/aside/fat/
-// @version 1.0-RC1
-// @author Adam Michela
-
-var Fat = {
- make_hex : function (r,g,b)
- {
- r = r.toString(16); if (r.length == 1) r = '0' + r;
- g = g.toString(16); if (g.length == 1) g = '0' + g;
- b = b.toString(16); if (b.length == 1) b = '0' + b;
- return "#" + r + g + b;
- },
- fade_all : function (dur)
- {
- var a = document.getElementsByTagName("*");
- for (var i = 0; i < a.length; i++)
- {
- var o = a[i];
- var r = /fade-?(\w{3,6})?/.exec(o.className);
- if (r)
- {
- if (!r[1]) r[1] = "";
- if (o.id) Fat.fade_element(o.id,null,dur,"#"+r[1]);
- }
- }
- },
- fade_element : function (id, fps, duration, from, to)
- {
- if (!fps) fps = 30;
- if (!duration) duration = 3000;
- if (!from || from=="#") from = "#FFFF33";
- if (!to) to = this.get_bgcolor(id);
-
- var frames = Math.round(fps * (duration / 1000));
- var interval = duration / frames;
- var delay = interval;
- var frame = 0;
-
- if (from.length < 7) from += from.substr(1,3);
- if (to.length < 7) to += to.substr(1,3);
-
- var rf = parseInt(from.substr(1,2),16);
- var gf = parseInt(from.substr(3,2),16);
- var bf = parseInt(from.substr(5,2),16);
- var rt = parseInt(to.substr(1,2),16);
- var gt = parseInt(to.substr(3,2),16);
- var bt = parseInt(to.substr(5,2),16);
-
- var r,g,b,h;
- while (frame < frames)
- {
- r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
- g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
- b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
- h = this.make_hex(r,g,b);
-
- setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);
-
- frame++;
- delay = interval * frame;
- }
- setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
- },
- set_bgcolor : function (id, c)
- {
- var o = document.getElementById(id);
- o.style.backgroundColor = c;
- },
- get_bgcolor : function (id)
- {
- var o = document.getElementById(id);
- while(o)
- {
- var c;
- if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
- if (o.currentStyle) c = o.currentStyle.backgroundColor;
- if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
- o = o.parentNode;
- }
- if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
- var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
- if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
- return c;
- }
-}
-
-addLoadEvent(function () {
- Fat.fade_all();
-});
diff --git a/wp-includes/js/jquery/jquery.color.js b/wp-includes/js/jquery/jquery.color.js
new file mode 100644
index 0000000..1dffbd5
--- /dev/null
+++ b/wp-includes/js/jquery/jquery.color.js
@@ -0,0 +1,128 @@
+/*
+ * jQuery Color Animations
+ * Copyright 2007 John Resig
+ * Released under the MIT and GPL licenses.
+ */
+
+(function(jQuery){
+
+ // We override the animation for all of these color styles
+ jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
+ jQuery.fx.step[attr] = function(fx){
+ if ( fx.state == 0 ) {
+ fx.start = getColor( fx.elem, attr );
+ fx.end = getRGB( fx.end );
+ }
+
+ fx.elem.style[attr] = "rgb(" + [
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+ ].join(",") + ")";
+ }
+ });
+
+ // Color Conversion functions from highlightFade
+ // By Blair Mitchelmore
+ // http://jquery.offput.ca/highlightFade/
+
+ // Parse strings looking for color tuples [255,255,255]
+ function getRGB(color) {
+ var result;
+
+ // Check if we're already dealing with an array of colors
+ if ( color && color.constructor == Array && color.length == 3 )
+ return color;
+
+ // Look for rgb(num,num,num)
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+ return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
+
+ // Look for rgb(num%,num%,num%)
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+ // Look for #a0b1c2
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+ // Look for #fff
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+ // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+ if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+ return colors['transparent']
+
+ // Otherwise, we're most likely dealing with a named color
+ return colors[jQuery.trim(color).toLowerCase()];
+ }
+
+ function getColor(elem, attr) {
+ var color;
+
+ do {
+ color = jQuery.curCSS(elem, attr);
+
+ // Keep going until we find an element that has color, or we hit the body
+ if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+ break;
+
+ attr = "backgroundColor";
+ } while ( elem = elem.parentNode );
+
+ return getRGB(color);
+ };
+
+ // Some named colors to work with
+ // From Interface by Stefan Petre
+ // http://interface.eyecon.ro/
+
+ var colors = {
+ aqua:[0,255,255],
+ azure:[240,255,255],
+ beige:[245,245,220],
+ black:[0,0,0],
+ blue:[0,0,255],
+ brown:[165,42,42],
+ cyan:[0,255,255],
+ darkblue:[0,0,139],
+ darkcyan:[0,139,139],
+ darkgrey:[169,169,169],
+ darkgreen:[0,100,0],
+ darkkhaki:[189,183,107],
+ darkmagenta:[139,0,139],
+ darkolivegreen:[85,107,47],
+ darkorange:[255,140,0],
+ darkorchid:[153,50,204],
+ darkred:[139,0,0],
+ darksalmon:[233,150,122],
+ darkviolet:[148,0,211],
+ fuchsia:[255,0,255],
+ gold:[255,215,0],
+ green:[0,128,0],
+ indigo:[75,0,130],
+ khaki:[240,230,140],
+ lightblue:[173,216,230],
+ lightcyan:[224,255,255],
+ lightgreen:[144,238,144],
+ lightgrey:[211,211,211],
+ lightpink:[255,182,193],
+ lightyellow:[255,255,224],
+ lime:[0,255,0],
+ magenta:[255,0,255],
+ maroon:[128,0,0],
+ navy:[0,0,128],
+ olive:[128,128,0],
+ orange:[255,165,0],
+ pink:[255,192,203],
+ purple:[128,0,128],
+ violet:[128,0,128],
+ red:[255,0,0],
+ silver:[192,192,192],
+ white:[255,255,255],
+ yellow:[255,255,0],
+ transparent: [255,255,255]
+ };
+
+})(jQuery);
diff --git a/wp-includes/js/jquery/jquery.dimensions.min.js b/wp-includes/js/jquery/jquery.dimensions.min.js
new file mode 100644
index 0000000..34c06de
--- /dev/null
+++ b/wp-includes/js/jquery/jquery.dimensions.min.js
@@ -0,0 +1,12 @@
+/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
+ * $Rev: 4257 $
+ *
+ * Version: 1.2
+ *
+ * Requires: jQuery 1.2+
+ */
+(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery); \ No newline at end of file
diff --git a/wp-includes/js/jquery/jquery.schedule.js b/wp-includes/js/jquery/jquery.schedule.js
new file mode 100644
index 0000000..f00e7b3
--- /dev/null
+++ b/wp-includes/js/jquery/jquery.schedule.js
@@ -0,0 +1,36 @@
+
+(function($){$.scheduler=function(){this.bucket={};return;};$.scheduler.prototype={schedule:function(){var ctx={"id":null,"time":1000,"repeat":false,"protect":false,"obj":null,"func":function(){},"args":[]};function _isfn(fn){return(!!fn&&typeof fn!="string"&&typeof fn[0]=="undefined"&&RegExp("function","i").test(fn+""));};var i=0;var override=false;if(typeof arguments[i]=="object"&&arguments.length>1){override=true;i++;}
+if(typeof arguments[i]=="object"){for(var option in arguments[i])
+if(typeof ctx[option]!="undefined")
+ctx[option]=arguments[i][option];i++;}
+if(typeof arguments[i]=="number"||(typeof arguments[i]=="string"&&arguments[i].match(RegExp("^[0-9]+[smhdw]$"))))
+ctx["time"]=arguments[i++];if(typeof arguments[i]=="boolean")
+ctx["repeat"]=arguments[i++];if(typeof arguments[i]=="boolean")
+ctx["protect"]=arguments[i++];if(typeof arguments[i]=="object"&&typeof arguments[i+1]=="string"&&_isfn(arguments[i][arguments[i+1]])){ctx["obj"]=arguments[i++];ctx["func"]=arguments[i++];}
+else if(typeof arguments[i]!="undefined"&&(_isfn(arguments[i])||typeof arguments[i]=="string"))
+ctx["func"]=arguments[i++];while(typeof arguments[i]!="undefined")
+ctx["args"].push(arguments[i++]);if(override){if(typeof arguments[1]=="object"){for(var option in arguments[0])
+if(typeof ctx[option]!="undefined"&&typeof arguments[1][option]=="undefined")
+ctx[option]=arguments[0][option];}
+else{for(var option in arguments[0])
+if(typeof ctx[option]!="undefined")
+ctx[option]=arguments[0][option];}
+i++;}
+ctx["_scheduler"]=this;ctx["_handle"]=null;var match=String(ctx["time"]).match(RegExp("^([0-9]+)([smhdw])$"));if(match&&match[0]!="undefined"&&match[1]!="undefined")
+ctx["time"]=String(parseInt(match[1])*{s:1000,m:1000*60,h:1000*60*60,d:1000*60*60*24,w:1000*60*60*24*7}[match[2]]);if(ctx["id"]==null)
+ctx["id"]=(String(ctx["repeat"])+":"
++String(ctx["protect"])+":"
++String(ctx["time"])+":"
++String(ctx["obj"])+":"
++String(ctx["func"])+":"
++String(ctx["args"]));if(ctx["protect"])
+if(typeof this.bucket[ctx["id"]]!="undefined")
+return this.bucket[ctx["id"]];if(!_isfn(ctx["func"])){if(ctx["obj"]!=null&&typeof ctx["obj"]=="object"&&typeof ctx["func"]=="string"&&_isfn(ctx["obj"][ctx["func"]]))
+ctx["func"]=ctx["obj"][ctx["func"]];else
+ctx["func"]=eval("function () { "+ctx["func"]+" }");}
+ctx["_handle"]=this._schedule(ctx);this.bucket[ctx["id"]]=ctx;return ctx;},reschedule:function(ctx){if(typeof ctx=="string")
+ctx=this.bucket[ctx];ctx["_handle"]=this._schedule(ctx);return ctx;},_schedule:function(ctx){var trampoline=function(){var obj=(ctx["obj"]!=null?ctx["obj"]:ctx);(ctx["func"]).apply(obj,ctx["args"]);if(typeof(ctx["_scheduler"]).bucket[ctx["id"]]!="undefined"&&ctx["repeat"])
+(ctx["_scheduler"])._schedule(ctx);else
+delete(ctx["_scheduler"]).bucket[ctx["id"]];};return setTimeout(trampoline,ctx["time"]);},cancel:function(ctx){if(typeof ctx=="string")
+ctx=this.bucket[ctx];if(typeof ctx=="object"){clearTimeout(ctx["_handle"]);delete this.bucket[ctx["id"]];}}};$.extend({scheduler$:new $.scheduler(),schedule:function(){return $.scheduler$.schedule.apply($.scheduler$,arguments)},reschedule:function(){return $.scheduler$.reschedule.apply($.scheduler$,arguments)},cancel:function(){return $.scheduler$.cancel.apply($.scheduler$,arguments)}});$.fn.extend({schedule:function(){var a=[{}];for(var i=0;i<arguments.length;i++)
+a.push(arguments[i]);return this.each(function(){a[0]={"id":this,"obj":this};return $.schedule.apply($,a);});}});})(jQuery); \ No newline at end of file
diff --git a/wp-includes/js/jquery/suggest.js b/wp-includes/js/jquery/suggest.js
new file mode 100644
index 0000000..656e58b
--- /dev/null
+++ b/wp-includes/js/jquery/suggest.js
@@ -0,0 +1,310 @@
+/*
+ * jquery.suggest 1.1 - 2007-08-06
+ *
+ * Uses code and techniques from following libraries:
+ * 1. http://www.dyve.net/jquery/?autocomplete
+ * 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
+ *
+ * All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
+ * Feel free to do whatever you want with this file
+ *
+ */
+
+(function($) {
+
+ $.suggest = function(input, options) {
+
+ var $input = $(input).attr("autocomplete", "off");
+ var $results = $(document.createElement("ul"));
+
+ var timeout = false; // hold timeout ID for suggestion results to appear
+ var prevLength = 0; // last recorded length of $input.val()
+ var cache = []; // cache MRU list
+ var cacheSize = 0; // size of cache in chars (bytes?)
+
+ $results.addClass(options.resultsClass).appendTo('body');
+
+
+ resetPosition();
+ $(window)
+ .load(resetPosition) // just in case user is changing size of page while loading
+ .resize(resetPosition);
+
+ $input.blur(function() {
+ setTimeout(function() { $results.hide() }, 200);
+ });
+
+
+ // help IE users if possible
+ try {
+ $results.bgiframe();
+ } catch(e) { }
+
+
+ // I really hate browser detection, but I don't see any other way
+ if ($.browser.mozilla)
+ $input.keypress(processKey); // onkeypress repeats arrow keys in Mozilla/Opera
+ else
+ $input.keydown(processKey); // onkeydown repeats arrow keys in IE/Safari
+
+
+
+
+ function resetPosition() {
+ // requires jquery.dimension plugin
+ var offset = $input.offset();
+ $results.css({
+ top: (offset.top + input.offsetHeight) + 'px',
+ left: offset.left + 'px'
+ });
+ }
+
+
+ function processKey(e) {
+
+ // handling up/down/escape requires results to be visible
+ // handling enter/tab requires that AND a result to be selected
+ if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
+ (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
+
+ if (e.preventDefault)
+ e.preventDefault();
+ if (e.stopPropagation)
+ e.stopPropagation();
+
+ e.cancelBubble = true;
+ e.returnValue = false;
+
+ switch(e.keyCode) {
+
+ case 38: // up
+ prevResult();
+ break;
+
+ case 40: // down
+ nextResult();
+ break;
+
+ case 9: // tab
+ case 13: // return
+ selectCurrentResult();
+ break;
+
+ case 27: // escape
+ $results.hide();
+ break;
+
+ }
+
+ } else if ($input.val().length != prevLength) {
+
+ if (timeout)
+ clearTimeout(timeout);
+ timeout = setTimeout(suggest, options.delay);
+ prevLength = $input.val().length;
+
+ }
+
+
+ }
+
+
+ function suggest() {
+
+ var q = $.trim($input.val());
+
+ if (q.length >= options.minchars) {
+
+ cached = checkCache(q);
+
+ if (cached) {
+
+ displayItems(cached['items']);
+
+ } else {
+
+ $.get(options.source, {q: q}, function(txt) {
+
+ $results.hide();
+
+ var items = parseTxt(txt, q);
+
+ displayItems(items);
+ addToCache(q, items, txt.length);
+
+ });
+
+ }
+
+ } else {
+
+ $results.hide();
+
+ }
+
+ }
+
+
+ function checkCache(q) {
+
+ for (var i = 0; i < cache.length; i++)
+ if (cache[i]['q'] == q) {
+ cache.unshift(cache.splice(i, 1)[0]);
+ return cache[0];
+ }
+
+ return false;
+
+ }
+
+ function addToCache(q, items, size) {
+
+ while (cache.length && (cacheSize + size > options.maxCacheSize)) {
+ var cached = cache.pop();
+ cacheSize -= cached['size'];
+ }
+
+ cache.push({
+ q: q,
+ size: size,
+ items: items
+ });
+
+ cacheSize += size;
+
+ }
+
+ function displayItems(items) {
+
+ if (!items)
+ return;
+
+ if (!items.length) {
+ $results.hide();
+ return;
+ }
+
+ var html = '';
+ for (var i = 0; i < items.length; i++)
+ html += '<li>' + items[i] + '</li>';
+
+ $results.html(html).show();
+
+ $results
+ .children('li')
+ .mouseover(function() {
+ $results.children('li').removeClass(options.selectClass);
+ $(this).addClass(options.selectClass);
+ })
+ .click(function(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ selectCurrentResult();
+ });
+
+ }
+
+ function parseTxt(txt, q) {
+
+ var items = [];
+ var tokens = txt.split(options.delimiter);
+
+ // parse returned data for non-empty items
+ for (var i = 0; i < tokens.length; i++) {
+ var token = $.trim(tokens[i]);
+ if (token) {
+ token = token.replace(
+ new RegExp(q, 'ig'),
+ function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
+ );
+ items[items.length] = token;
+ }
+ }
+
+ return items;
+ }
+
+ function getCurrentResult() {
+
+ if (!$results.is(':visible'))
+ return false;
+
+ var $currentResult = $results.children('li.' + options.selectClass);
+
+ if (!$currentResult.length)
+ $currentResult = false;
+
+ return $currentResult;
+
+ }
+
+ function selectCurrentResult() {
+
+ $currentResult = getCurrentResult();
+
+ if ($currentResult) {
+ $input.val($currentResult.text());
+ $results.hide();
+
+ if (options.onSelect)
+ options.onSelect.apply($input[0]);
+
+ }
+
+ }
+
+ function nextResult() {
+
+ $currentResult = getCurrentResult();
+
+ if ($currentResult)
+ $currentResult
+ .removeClass(options.selectClass)
+ .next()
+ .addClass(options.selectClass);
+ else
+ $results.children('li:first-child').addClass(options.selectClass);
+
+ }
+
+ function prevResult() {
+
+ $currentResult = getCurrentResult();
+
+ if ($currentResult)
+ $currentResult
+ .removeClass(options.selectClass)
+ .prev()
+ .addClass(options.selectClass);
+ else
+ $results.children('li:last-child').addClass(options.selectClass);
+
+ }
+
+ }
+
+ $.fn.suggest = function(source, options) {
+
+ if (!source)
+ return;
+
+ options = options || {};
+ options.source = source;
+ options.delay = options.delay || 100;
+ options.resultsClass = options.resultsClass || 'ac_results';
+ options.selectClass = options.selectClass || 'ac_over';
+ options.matchClass = options.matchClass || 'ac_match';
+ options.minchars = options.minchars || 2;
+ options.delimiter = options.delimiter || '\n';
+ options.onSelect = options.onSelect || false;
+ options.maxCacheSize = options.maxCacheSize || 65536;
+
+ this.each(function() {
+ new $.suggest(this, options);
+ });
+
+ return this;
+
+ };
+
+})(jQuery); \ No newline at end of file
diff --git a/wp-includes/js/jquery/ui.tabs.js b/wp-includes/js/jquery/ui.tabs.js
new file mode 100644
index 0000000..8634b41
--- /dev/null
+++ b/wp-includes/js/jquery/ui.tabs.js
@@ -0,0 +1,529 @@
+/*
+ * Tabs 3 - New Wave Tabs
+ *
+ * Copyright (c) 2007 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ */
+
+(function($) {
+
+ // if the UI scope is not availalable, add it
+ $.ui = $.ui || {};
+
+ // tabs initialization
+ $.fn.tabs = function(initial, options) {
+ if (initial && initial.constructor == Object) { // shift arguments
+ options = initial;
+ initial = null;
+ }
+ options = options || {};
+
+ initial = initial && initial.constructor == Number && --initial || 0;
+
+ return this.each(function() {
+ new $.ui.tabs(this, $.extend(options, { initial: initial }));
+ });
+ };
+
+ // other chainable tabs methods
+ $.each(['Add', 'Remove', 'Enable', 'Disable', 'Click', 'Load', 'Href'], function(i, method) {
+ $.fn['tabs' + method] = function() {
+ var args = arguments;
+ return this.each(function() {
+ var instance = $.ui.tabs.getInstance(this);
+ instance[method.toLowerCase()].apply(instance, args);
+ });
+ };
+ });
+ $.fn.tabsSelected = function() {
+ var selected = -1;
+ if (this[0]) {
+ var instance = $.ui.tabs.getInstance(this[0]),
+ $lis = $('li', this);
+ selected = $lis.index( $lis.filter('.' + instance.options.selectedClass)[0] );
+ }
+ return selected >= 0 ? ++selected : -1;
+ };
+
+ // tabs class
+ $.ui.tabs = function(el, options) {
+
+ this.source = el;
+
+ this.options = $.extend({
+
+ // basic setup
+ initial: 0,
+ event: 'click',
+ disabled: [],
+ cookie: null, // pass options object as expected by cookie plugin: { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ // TODO bookmarkable: $.ajaxHistory ? true : false,
+ unselected: false,
+ unselect: options.unselected ? true : false,
+
+ // Ajax
+ spinner: 'Loading&#8230;',
+ cache: false,
+ idPrefix: 'ui-tabs-',
+ ajaxOptions: {},
+
+ // animations
+ /*fxFade: null,
+ fxSlide: null,
+ fxShow: null,
+ fxHide: null,*/
+ fxSpeed: 'normal',
+ /*fxShowSpeed: null,
+ fxHideSpeed: null,*/
+
+ // callbacks
+ add: function() {},
+ remove: function() {},
+ enable: function() {},
+ disable: function() {},
+ click: function() {},
+ hide: function() {},
+ show: function() {},
+ load: function() {},
+
+ // templates
+ tabTemplate: '<li><a href="#{href}"><span>#{text}</span></a></li>',
+ panelTemplate: '<div></div>',
+
+ // CSS classes
+ navClass: 'ui-tabs-nav',
+ selectedClass: 'ui-tabs-selected',
+ unselectClass: 'ui-tabs-unselect',
+ disabledClass: 'ui-tabs-disabled',
+ panelClass: 'ui-tabs-panel',
+ hideClass: 'ui-tabs-hide',
+ loadingClass: 'ui-tabs-loading'
+
+ }, options);
+
+ this.options.event += '.ui-tabs'; // namespace event
+ this.options.cookie = $.cookie && $.cookie.constructor == Function && this.options.cookie;
+
+ // save instance for later
+ $.data(el, $.ui.tabs.INSTANCE_KEY, this);
+
+ // create tabs
+ this.tabify(true);
+ };
+
+ // static
+ $.ui.tabs.INSTANCE_KEY = 'ui_tabs_instance';
+ $.ui.tabs.getInstance = function(el) {
+ return $.data(el, $.ui.tabs.INSTANCE_KEY);
+ };
+
+ // instance methods
+ $.extend($.ui.tabs.prototype, {
+ tabId: function(a) {
+ return a.title ? a.title.replace(/\s/g, '_')
+ : this.options.idPrefix + $.data(a);
+ },
+ tabify: function(init) {
+
+ this.$lis = $('li:has(a[href])', this.source);
+ this.$tabs = this.$lis.map(function() { return $('a', this)[0] });
+ this.$panels = $([]);
+
+ var self = this, o = this.options;
+
+ this.$tabs.each(function(i, a) {
+ // inline tab
+ if (a.hash && a.hash.replace('#', '')) { // Safari 2 reports '#' for an empty hash
+ self.$panels = self.$panels.add(a.hash);
+ }
+ // remote tab
+ else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
+ $.data(a, 'href', a.href);
+ var id = self.tabId(a);
+ a.href = '#' + id;
+ self.$panels = self.$panels.add(
+ $('#' + id)[0] || $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
+ .insertAfter( self.$panels[i - 1] || self.source )
+ );
+ }
+ // invalid tab href
+ else {
+ o.disabled.push(i + 1);
+ }
+ });
+
+ if (init) {
+
+ // attach necessary classes for styling if not present
+ $(this.source).hasClass(o.navClass) || $(this.source).addClass(o.navClass);
+ this.$panels.each(function() {
+ var $this = $(this);
+ $this.hasClass(o.panelClass) || $this.addClass(o.panelClass);
+ });
+
+ // disabled tabs
+ for (var i = 0, position; position = o.disabled[i]; i++) {
+ this.disable(position);
+ }
+
+ // Try to retrieve initial tab:
+ // 1. from fragment identifier in url if present
+ // 2. from cookie
+ // 3. from selected class attribute on <li>
+ // 4. otherwise use given initial argument
+ // 5. check if tab is disabled
+ this.$tabs.each(function(i, a) {
+ if (location.hash) {
+ if (a.hash == location.hash) {
+ o.initial = i;
+ // prevent page scroll to fragment
+ //if (($.browser.msie || $.browser.opera) && !o.remote) {
+ if ($.browser.msie || $.browser.opera) {
+ var $toShow = $(location.hash), toShowId = $toShow.attr('id');
+ $toShow.attr('id', '');
+ setTimeout(function() {
+ $toShow.attr('id', toShowId); // restore id
+ }, 500);
+ }
+ scrollTo(0, 0);
+ return false; // break
+ }
+ } else if (o.cookie) {
+ o.initial = parseInt($.cookie( $.ui.tabs.INSTANCE_KEY + $.data(self.source) )) || 0;
+ return false; // break
+ } else if ( self.$lis.eq(i).hasClass(o.selectedClass) ) {
+ o.initial = i;
+ return false; // break
+ }
+ });
+ var n = this.$lis.length;
+ while (this.$lis.eq(o.initial).hasClass(o.disabledClass) && n) {
+ o.initial = ++o.initial < this.$lis.length ? o.initial : 0;
+ n--;
+ }
+ if (!n) { // all tabs disabled, set option unselected to true
+ o.unselected = o.unselect = true;
+ }
+
+ // highlight selected tab
+ this.$panels.addClass(o.hideClass);
+ this.$lis.removeClass(o.selectedClass);
+ if (!o.unselected) {
+ this.$panels.eq(o.initial).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
+ this.$lis.eq(o.initial).addClass(o.selectedClass);
+ }
+
+ // load if remote tab
+ var href = !o.unselected && $.data(this.$tabs[o.initial], 'href');
+ if (href) {
+ this.load(o.initial + 1, href);
+ }
+
+ // disable click if event is configured to something else
+ if (!/^click/.test(o.event)) {
+ this.$tabs.bind('click', function(e) { e.preventDefault(); });
+ }
+
+ }
+
+ // setup animations
+ var showAnim = {}, showSpeed = o.fxShowSpeed || o.fxSpeed,
+ hideAnim = {}, hideSpeed = o.fxHideSpeed || o.fxSpeed;
+ if (o.fxSlide || o.fxFade) {
+ if (o.fxSlide) {
+ showAnim['height'] = 'show';
+ hideAnim['height'] = 'hide';
+ }
+ if (o.fxFade) {
+ showAnim['opacity'] = 'show';
+ hideAnim['opacity'] = 'hide';
+ }
+ } else {
+ if (o.fxShow) {
+ showAnim = o.fxShow;
+ } else { // use some kind of animation to prevent browser scrolling to the tab
+ showAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
+ showSpeed = 1; // as little as 1 is sufficient
+ }
+ if (o.fxHide) {
+ hideAnim = o.fxHide;
+ } else { // use some kind of animation to prevent browser scrolling to the tab
+ hideAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
+ hideSpeed = 1; // as little as 1 is sufficient
+ }
+ }
+
+ // reset some styles to maintain print style sheets etc.
+ var resetCSS = { display: '', overflow: '', height: '' };
+ if (!$.browser.msie) { // not in IE to prevent ClearType font issue
+ resetCSS['opacity'] = '';
+ }
+
+ // Hide a tab, animation prevents browser scrolling to fragment,
+ // $show is optional.
+ function hideTab(clicked, $hide, $show) {
+ $hide.animate(hideAnim, hideSpeed, function() { //
+ $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
+ if ($.browser.msie && hideAnim['opacity']) {
+ $hide[0].style.filter = '';
+ }
+ o.hide(clicked, $hide[0], $show && $show[0] || null);
+ if ($show) {
+ showTab(clicked, $show, $hide);
+ }
+ });
+ }
+
+ // Show a tab, animation prevents browser scrolling to fragment,
+ // $hide is optional
+ function showTab(clicked, $show, $hide) {
+ if (!(o.fxSlide || o.fxFade || o.fxShow)) {
+ $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
+ }
+ $show.animate(showAnim, showSpeed, function() {
+ $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
+ if ($.browser.msie && showAnim['opacity']) {
+ $show[0].style.filter = '';
+ }
+ o.show(clicked, $show[0], $hide && $hide[0] || null);
+ });
+ }
+
+ // switch a tab
+ function switchTab(clicked, $li, $hide, $show) {
+ /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
+ $.ajaxHistory.update(clicked.hash);
+ }*/
+ $li.addClass(o.selectedClass)
+ .siblings().removeClass(o.selectedClass);
+ hideTab(clicked, $hide, $show);
+ }
+
+ // attach tab event handler, unbind to avoid duplicates from former tabifying...
+ this.$tabs.unbind(o.event).bind(o.event, function() {
+
+ //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
+ var $li = $(this).parents('li:eq(0)'),
+ $hide = self.$panels.filter(':visible'),
+ $show = $(this.hash);
+
+ // If tab is already selected and not unselectable or tab disabled or click callback returns false stop here.
+ // Check if click handler returns false last so that it is not executed for a disabled tab!
+ if (($li.hasClass(o.selectedClass) && !o.unselect) || $li.hasClass(o.disabledClass)
+ || o.click(this, $show[0], $hide[0]) === false) {
+ this.blur();
+ return false;
+ }
+
+ if (o.cookie) {
+ $.cookie($.ui.tabs.INSTANCE_KEY + $.data(self.source), self.$tabs.index(this), o.cookie);
+ }
+
+ // if tab may be closed
+ if (o.unselect) {
+ if ($li.hasClass(o.selectedClass)) {
+ $li.removeClass(o.selectedClass);
+ self.$panels.stop();
+ hideTab(this, $hide);
+ this.blur();
+ return false;
+ } else if (!$hide.length) {
+ self.$panels.stop();
+ if ($.data(this, 'href')) { // remote tab
+ var a = this;
+ self.load(self.$tabs.index(this) + 1, $.data(this, 'href'), function() {
+ $li.addClass(o.selectedClass).addClass(o.unselectClass);
+ showTab(a, $show);
+ });
+ } else {
+ $li.addClass(o.selectedClass).addClass(o.unselectClass);
+ showTab(this, $show);
+ }
+ this.blur();
+ return false;
+ }
+ }
+
+ // stop possibly running animations
+ self.$panels.stop();
+
+ // show new tab
+ if ($show.length) {
+
+ // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
+ /*if ($.browser.msie && o.bookmarkable) {
+ var showId = this.hash.replace('#', '');
+ $show.attr('id', '');
+ setTimeout(function() {
+ $show.attr('id', showId); // restore id
+ }, 0);
+ }*/
+
+ if ($.data(this, 'href')) { // remote tab
+ var a = this;
+ self.load(self.$tabs.index(this) + 1, $.data(this, 'href'), function() {
+ switchTab(a, $li, $hide, $show);
+ });
+ } else {
+ switchTab(this, $li, $hide, $show);
+ }
+
+ // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
+ /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;
+ var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;
+ setTimeout(function() {
+ scrollTo(scrollX, scrollY);
+ }, 0);*/
+
+ } else {
+ throw 'jQuery UI Tabs: Mismatching fragment identifier.';
+ }
+
+ // Prevent IE from keeping other link focussed when using the back button
+ // and remove dotted border from clicked link. This is controlled in modern
+ // browsers via CSS, also blur removes focus from address bar in Firefox
+ // which can become a usability and annoying problem with tabsRotate.
+ if ($.browser.msie) {
+ this.blur();
+ }
+
+ //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE
+ return false;
+
+ });
+
+ },
+ add: function(url, text, position) {
+ if (url && text) {
+ position = position || this.$tabs.length; // append by default
+
+ var o = this.options,
+ $li = $(o.tabTemplate.replace(/#\{href\}/, url).replace(/#\{text\}/, text));
+
+ var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );
+
+ // try to find an existing element before creating a new one
+ var $panel = $('#' + id);
+ $panel = $panel.length && $panel
+ || $(o.panelTemplate).attr('id', id).addClass(o.panelClass).addClass(o.hideClass);
+ if (position >= this.$lis.length) {
+ $li.appendTo(this.source);
+ $panel.appendTo(this.source.parentNode);
+ } else {
+ $li.insertBefore(this.$lis[position - 1]);
+ $panel.insertBefore(this.$panels[position - 1]);
+ }
+
+ this.tabify();
+
+ if (this.$tabs.length == 1) {
+ $li.addClass(o.selectedClass);
+ $panel.removeClass(o.hideClass);
+ var href = $.data(this.$tabs[0], 'href');
+ if (href) {
+ this.load(position + 1, href);
+ }
+ }
+ o.add(this.$tabs[position], this.$panels[position]); // callback
+ } else {
+ throw 'jQuery UI Tabs: Not enough arguments to add tab.';
+ }
+ },
+ remove: function(position) {
+ if (position && position.constructor == Number) {
+ var o = this.options, $li = this.$lis.eq(position - 1).remove(),
+ $panel = this.$panels.eq(position - 1).remove();
+
+ // If selected tab was removed focus tab to the right or
+ // tab to the left if last tab was removed.
+ if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1) {
+ this.click(position + (position < this.$tabs.length ? 1 : -1));
+ }
+ this.tabify();
+ o.remove($li.end()[0], $panel[0]); // callback
+ }
+ },
+ enable: function(position) {
+ var o = this.options, $li = this.$lis.eq(position - 1);
+ $li.removeClass(o.disabledClass);
+ if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
+ $li.css('display', 'inline-block');
+ setTimeout(function() {
+ $li.css('display', 'block')
+ }, 0)
+ }
+ o.enable(this.$tabs[position - 1], this.$panels[position - 1]); // callback
+ },
+ disable: function(position) {
+ var o = this.options;
+ this.$lis.eq(position - 1).addClass(o.disabledClass);
+ o.disable(this.$tabs[position - 1], this.$panels[position - 1]); // callback
+ },
+ click: function(position) {
+ this.$tabs.eq(position - 1).trigger(this.options.event);
+ },
+ load: function(position, url, callback) {
+ var self = this, o = this.options,
+ $a = this.$tabs.eq(position - 1), a = $a[0], $span = $('span', a);
+
+ // shift arguments
+ if (url && url.constructor == Function) {
+ callback = url;
+ url = null;
+ }
+
+ // set new URL or get existing
+ if (url) {
+ $.data(a, 'href', url);
+ } else {
+ url = $.data(a, 'href');
+ }
+
+ // load
+ if (o.spinner) {
+ $.data(a, 'title', $span.html());
+ $span.html('<em>' + o.spinner + '</em>');
+ }
+ var finish = function() {
+ self.$tabs.filter('.' + o.loadingClass).each(function() {
+ $(this).removeClass(o.loadingClass);
+ if (o.spinner) {
+ $('span', this).html( $.data(this, 'title') );
+ }
+ });
+ self.xhr = null;
+ };
+ var ajaxOptions = $.extend(o.ajaxOptions, {
+ url: url,
+ success: function(r) {
+ $(a.hash).html(r);
+ finish();
+ // This callback is required because the switch has to take
+ // place after loading has completed.
+ if (callback && callback.constructor == Function) {
+ callback();
+ }
+ if (o.cache) {
+ $.removeData(a, 'href'); // if loaded once do not load them again
+ }
+ o.load(self.$tabs[position - 1], self.$panels[position - 1]); // callback
+ }
+ });
+ if (this.xhr) {
+ // terminate pending requests from other tabs and restore title
+ this.xhr.abort();
+ finish();
+ }
+ $a.addClass(o.loadingClass);
+ setTimeout(function() { // timeout is again required in IE, "wait" for id being restored
+ self.xhr = $.ajax(ajaxOptions);
+ }, 0);
+
+ },
+ href: function(position, href) {
+ $.data(this.$tabs.eq(position - 1)[0], 'href', href);
+ }
+ });
+
+})(jQuery);
diff --git a/wp-includes/js/list-manipulation.js b/wp-includes/js/list-manipulation.js
deleted file mode 100644
index e522709..0000000
--- a/wp-includes/js/list-manipulation.js
+++ /dev/null
@@ -1,295 +0,0 @@
-addLoadEvent( function() {
- if ( 'undefined' != typeof listManL10n )
- Object.extend(listMan.prototype, listManL10n);
- theList = new listMan();
-} );
-
-function deleteSomething( what, id, message, obj ) {
- if ( !obj )
- obj=theList;
- if ( !message )
- message = obj.delText.replace(/%thing%/g, what);
- if( confirm(message) )
- return obj.ajaxDelete( what, id );
- else return false;
-}
-
-function dimSomething( what, id, dimClass, obj ) {
- if ( !obj )
- obj = theList;
- return obj.ajaxDimmer(what,id,dimClass);
-}
-
-var listMan = Class.create();
-Object.extend(listMan.prototype, {
- ajaxRespEl: 'ajax-response',
- ajaxHandler: false,
- inputData: '',
- clearInputs: [],
- showLink: true,
- topAdder: false,
- alt: 'alternate',
- altOffset: 0,
- addComplete: null,
- delComplete: null,
- dimComplete: null,
- dataStore: null,
- formStore: null,
-
- jumpText: '', // We get these from listManL10n
- delText: '',
-
- initialize: function(theListId) {
- this.theList = $(theListId ? theListId : 'the-list');
- if ( !this.theList )
- return false;
- Element.cleanWhitespace(this.theList);
- },
-
- // sends add-what and fields contained in where
- // recieves html with top element having an id like what-#
- ajaxAdder: function( what, where, update ) { // Do NOT wrap TR in TABLE TBODY
- var ajaxAdd = new WPAjax( this.ajaxHandler, this.ajaxRespEl );
- if ( ajaxAdd.notInitialized() )
- return true;
- var action = ( update ? 'update-' : 'add-' ) + what;
- ajaxAdd.options.parameters = $H(ajaxAdd.options.parameters).merge({action: action}).merge(this.inputData.toQueryParams()).merge(this.grabInputs( where, ajaxAdd ).toQueryParams());
-
- var tempObj=this;
- ajaxAdd.addOnComplete( function(transport) {
- var newItems = $A(transport.responseXML.getElementsByTagName(what));
- if ( newItems ) {
- var showLinkMessage = '';
- var m = '';
- newItems.each( function(i) {
- var id = i.getAttribute('id');
- var exists = $(what+'-'+id);
- if ( exists )
- tempObj.replaceListItem( exists, getNodeValue(i,'response_data'), update );
- else
- tempObj.addListItem( getNodeValue(i, 'response_data') );
- m = getNodeValue(i, 'show-link');
- showLinkMessage += showLinkMessage ? "<br />\n" : '';
- if ( m )
- showLinkMessage += m;
- else
- showLinkMessage += "<a href='#" + what + '-' + id + "'>" + tempObj.jumpText + "</a>";
- });
- if ( tempObj.showLink && showLinkMessage )
- Element.update(ajaxAdd.myResponseElement,"<div id='jumplink' class='updated fade'><p>" + showLinkMessage + "</p></div>");
- }
- if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' )
- tempObj.addComplete( what, where, update, transport );
- tempObj.recolorList();
- ajaxAdd.restoreInputs = null;
- });
- if ( !update )
- ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); });
- ajaxAdd.request(ajaxAdd.url);
- if ( !update )
- this.clear();
- return false;
- },
-
- // sends update-what and fields contained in where
- // recieves html with top element having an id like what-#
- ajaxUpdater: function( what, where ) { return this.ajaxAdder( what, where, true ); },
-
- // sends delete-what and id#
- ajaxDelete: function( what, id ) {
- var ajaxDel = new WPAjax( this.ajaxHandler, this.ajaxRespEl );
- if( ajaxDel.notInitialized() )
- return true;
- var tempObj = this;
- var action = 'delete-' + what;
- var actionId = action + '&id=' + id;
- var idName = what.replace('-as-spam','') + '-' + id;
- ajaxDel.addOnComplete( function(transport) {
- Element.update(ajaxDel.myResponseElement,'');
- tempObj.destore(actionId);
- if( tempObj.delComplete && typeof tempObj.delComplete == 'function' )
- tempObj.delComplete( what, id, transport );
- });
- ajaxDel.addOnWPError( function(transport) { tempObj.restore(actionId, true); });
- ajaxDel.options.parameters = $H(ajaxDel.options.parameters).merge({action: action, id: id}).merge(this.inputData.toQueryParams());
- ajaxDel.request(ajaxDel.url);
- this.store(actionId, idName);
- tempObj.removeListItem( idName );
- return false;
- },
-
- // Toggles class nomes
- // sends dim-what and id#
- ajaxDimmer: function( what, id, dimClass ) {
- ajaxDim = new WPAjax( this.ajaxHandler, this.ajaxRespEl );
- if ( ajaxDim.notInitialized() )
- return true;
- var tempObj = this;
- var action = 'dim-' + what;
- var actionId = action + '&id=' + id;
- var idName = what + '-' + id;
- ajaxDim.addOnComplete( function(transport) {
- Element.update(ajaxDim.myResponseElement,'');
- tempObj.destore(actionId);
- if ( tempObj.dimComplete && typeof tempObj.dimComplete == 'function' )
- tempObj.dimComplete( what, id, dimClass, transport );
- });
- ajaxDim.addOnWPError( function(transport) { tempObj.restore(actionId, true); });
- ajaxDim.options.parameters = $H(ajaxDim.options.parameters).merge({action: action, id: id}).merge(this.inputData.toQueryParams());
- ajaxDim.request(ajaxDim.url);
- this.store(actionId, idName);
- this.dimItem( idName, dimClass );
- return false;
- },
-
- addListItem: function( h ) {
- new Insertion[this.topAdder ? 'Top' : 'Bottom'](this.theList,h);
- Element.cleanWhitespace(this.theList);
- var id = this.topAdder ? this.theList.firstChild.id : this.theList.lastChild.id;
- if ( this.alt )
- if ( ( this.theList.childNodes.length + this.altOffset ) % 2 )
- Element.addClassName($(id),this.alt);
- Fat.fade_element(id);
- },
-
- // only hides the element sa it can be put back again if necessary
- removeListItem: function( id, noFade ) {
- id = $(id);
- if ( !noFade ) {
- Fat.fade_element(id.id,null,700,'#FF3333');
- var tempObj = this;
- var func = function() { id.hide(); tempObj.recolorList(); }
- setTimeout(func, 705);
- } else {
- id.hide();
- this.recolorList();
- }
- },
-
- replaceListItem: function( id, h, update ) {
- id = $(id);
- if ( !update ) {
- Element.remove(id);
- this.addListItem( h );
- return;
- }
- id.replace(h);
- Fat.fade_element(id.id);
- },
-
- // toggles class
- dimItem: function( id, dimClass, noFade ) {
- id = $(id);
- if ( Element.hasClassName(id,dimClass) ) {
- if ( !noFade )
- Fat.fade_element(id.id,null,700,null);
- Element.removeClassName(id,dimClass);
- } else {
- if ( !noFade )
- Fat.fade_element(id.id,null,700,'#FF3333');
- Element.addClassName(id,dimClass);
- }
- },
-
- // store an element in case we need it later
- store: function(action, id) {
- if ( !this.dataStore )
- this.dataStore = $H();
- this.dataStore[action] = $(id).cloneNode(true);
- },
-
- // delete from store
- destore: function(action) { delete(this.dataStore[action]); },
-
- // restore element from store into existing (possibly hidden) element of same id
- restore: function(action, error) {
- var id = this.dataStore[action].id;
- this.theList.replaceChild(this.dataStore[action], $(id));
- delete(this.dataStore[action]);
- if ( error ) {
- func = function() { Element.setStyle($(id),{backgroundColor:'#FF3333'}); }
- func(); setTimeout(func, 705); // Hit it twice in case it's still fading.
- }
- },
-
- // Like Form.serialize, but excludes action and sets up clearInputs
- grabInputs: function( where, ajaxObj ) {
- if ( ajaxObj )
- ajaxObj.restoreInputs = [];
- var elements = Form.getElements($(where));
- var queryComponents = new Array();
- for (var i = 0; i < elements.length; i++) {
- if ( 'action' == elements[i].name )
- continue;
- if ( 'hidden' != elements[i].type && 'submit' != elements[i].type && 'button' != elements[i].type ) {
- this.clearInputs.push(elements[i]);
- if ( ajaxObj )
- ajaxObj.restoreInputs.push([elements[i], elements[i].value]);
- }
- var queryComponent = Form.Element.serialize(elements[i]);
- if (queryComponent) {
- queryComponents.push(queryComponent);
- }
- }
- return queryComponents.join('&');
- },
-
- // form.reset() can only do whole forms. This can do subsections.
- clear: function() {
- this.clearInputs.each( function(i) {
- i = $(i);
- if ( 'textarea' == i.tagName.toLowerCase() )
- i.value = '';
- else
- switch ( i.type.toLowerCase() ) {
- case 'password': case 'text':
- i.value = '';
- break;
- case 'checkbox': case 'radio':
- i.checked = false;
- break;
- case 'select': case 'select-one':
- i.selectedIndex = null;
- break;
- case 'select-multiple':
- for (var o = 0; o < i.length; o++) i.options[o].selected = false;
- break;
- }
- });
- this.clearInputs = [];
- },
-
- restoreForm: function(elements) {
- elements.each( function(i) {
- i[0].value = i[1];
- });
- },
-
- recolorList: function() {
- if ( !this.alt )
- return;
- var alt = this.alt;
- var offset = this.altOffset;
- var listItems = $A(this.theList.childNodes).findAll( function(i) { return Element.visible(i) } );
- listItems.each( function(i,n) {
- if ( ( n + offset ) % 2 )
- Element.removeClassName(i,alt);
- else
- Element.addClassName(i,alt);
- });
- }
-});
-
-//No submit unless code returns true.
-function killSubmit ( code, e ) {
- e = e ? e : window.event;
- if ( !e ) return;
- var t = e.target ? e.target : e.srcElement;
- if ( ( 'text' == t.type && e.keyCode == 13 ) || ( 'submit' == t.type && 'click' == e.type ) ) {
- if ( ( 'string' == typeof code && !eval(code) ) || ( 'function' == typeof code && !code() ) ) {
- e.returnValue = false; e.cancelBubble = true; return false;
- }
- }
-}
-//Generic but lame JS closure
-function encloseFunc(f){var a=arguments[1];return function(){return f(a);}}
diff --git a/wp-includes/js/swfupload/handlers.js b/wp-includes/js/swfupload/handlers.js
new file mode 100644
index 0000000..c53edf1
--- /dev/null
+++ b/wp-includes/js/swfupload/handlers.js
@@ -0,0 +1,227 @@
+function uploadLoaded() {
+ jQuery("#html-upload-ui").remove();
+ jQuery("#flash-upload-ui").show();
+}
+
+function fileDialogStart() {
+ jQuery("#media-upload-error").empty();
+}
+
+// progress and success handlers for media multi uploads
+function fileQueued(fileObj) {
+ // Get rid of unused form
+ jQuery('.media-blank').remove();
+ // Collapse a single item
+ if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
+ jQuery('.toggle').toggle();
+ jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+ }
+ // Create a progress bar containing the filename
+ jQuery('#media-items').append('<div id="media-item-' + fileObj.id + '" class="media-item child-of-' + post_id + '"><div class="filename original">' + fileObj.name + '</div><div class="progress"><div class="bar"></div></div></div>');
+
+ // Disable the submit button
+ jQuery('#insert-gallery').attr('disabled', 'disabled');
+}
+
+function uploadStart(fileObj) { return true; }
+
+function uploadProgress(fileObj, bytesDone, bytesTotal) {
+ // Lengthen the progress bar
+ jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal);
+
+ if ( bytesDone== bytesTotal )
+ jQuery('#media-item-' + fileObj.id + ' .bar').html('<strong style="display: block; padding-top: 9px; padding-left: 1em;">' + swfuploadL10n.crunching + '</strong>');
+}
+
+function prepareMediaItem(fileObj, serverData) {
+ // Move the progress bar to 100%
+ jQuery('#media-item-' + fileObj.id + ' .bar').remove();
+
+ // Append the HTML returned by the server -- thumbnail and form inputs
+ jQuery('#media-item-' + fileObj.id).append(serverData);
+
+ // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
+ jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
+
+ // Replace the original filename with the new (unique) one assigned during upload
+ jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
+
+ // Bind toggle function to a new mask over the progress bar area
+ jQuery('#media-item-' + fileObj.id + ' .progress').clone().empty().addClass('clickmask').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).siblings('.toggle').toggle();}).appendTo('#media-item-' + fileObj.id);
+
+ // Also bind toggle to the links
+ jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
+
+ // Bind AJAX to the new Delete button
+ jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
+ // Tell the server to delete it. TODO: handle exceptions
+ jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
+ id : this.id.replace(/[^0-9]/g,''),
+ action : 'delete-post',
+ _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
+ });
+ return false;
+ });
+
+ // Open this item if it says to start open (e.g. to display an error)
+ jQuery('#media-item-' + fileObj.id + '.startopen')
+ .removeClass('startopen')
+ .slideToggle(500)
+ .parent().eq(0).children('.toggle').toggle();
+}
+
+function itemAjaxError(id, html) {
+ var error = jQuery('#media-item-error' + id);
+
+ error.html('<div class="file-error"><button type="button" id="dismiss-'+id+'" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+html+'</div>');
+ jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})});
+}
+
+function deleteSuccess(data, textStatus) {
+ if ( data == '-1' )
+ return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
+ if ( data == '0' )
+ return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
+
+ var item = jQuery('#media-item-' + this.id);
+
+ // Decrement the counters.
+ if ( type = jQuery('#type-of-' + this.id).val() )
+ jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1);
+ if ( item.hasClass('child-of-'+post_id) )
+ jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1);
+
+ if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
+ jQuery('.toggle').toggle();
+ jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+ }
+
+ jQuery('#media-item-' + this.id + ' .filename:empty').remove();
+ jQuery('#media-item-' + this.id + ' .filename').append(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove();
+ jQuery('#media-item-' + this.id + ' .describe').slideUp(500, function(){jQuery(this).parents('.media-item').slideUp(1500,function(){jQuery(this).remove();updateMediaForm();})}).end.remove();
+
+ return;
+ // Vanish it.
+ item.slideToggle(300,function(){jQuery(this).remove();if(jQuery('.media-item').length==0)jQuery('.insert-gallery').hide();updateMediaForm();});
+}
+
+function deleteError(X, textStatus, errorThrown) {
+ // TODO
+}
+
+function updateMediaForm() {
+ // Just one file, no need for collapsible part
+ if ( jQuery('.type-form #media-items>*').length == 1 ) {
+ jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle();
+ jQuery('.type-form .slidetoggle').siblings().addClass('hidden');
+ }
+
+ // Only show Save buttons when there is at least one file.
+ if ( jQuery('#media-items>*').not('.media-blank').length > 0 )
+ jQuery('.savebutton').show();
+ else
+ jQuery('.savebutton').hide();
+
+ // Only show Gallery button when there are at least two files.
+ if ( jQuery('#media-items>*').length > 1 )
+ jQuery('.insert-gallery').show();
+ else
+ jQuery('.insert-gallery').hide();
+}
+
+function uploadSuccess(fileObj, serverData) {
+ // if async-upload returned an error message, place it in the media item div and return
+ if ( serverData.match('media-upload-error') ) {
+ jQuery('#media-item-' + fileObj.id).html(serverData);
+ return;
+ }
+
+ prepareMediaItem(fileObj, serverData);
+ updateMediaForm();
+
+ // Increment the counter.
+ if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) )
+ jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
+}
+
+function uploadComplete(fileObj) {
+ // If no more uploads queued, enable the submit button
+ if ( swfu.getStats().files_queued == 0 )
+ jQuery('#insert-gallery').attr('disabled', '');
+}
+
+
+// wp-specific error handlers
+
+// generic message
+function wpQueueError(message) {
+ jQuery('#media-upload-error').show().text(message);
+}
+
+// file-specific message
+function wpFileError(fileObj, message) {
+ jQuery('#media-item-' + fileObj.id + ' .filename').after('<div class="file-error"><button type="button" id="dismiss-' + fileObj.id + '" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+message+'</div>').siblings('.toggle').remove();
+ jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
+}
+
+function fileQueueError(fileObj, error_code, message) {
+ // Handle this error separately because we don't want to create a FileProgress element for it.
+ if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) {
+ wpQueueError(swfuploadL10n.queue_limit_exceeded);
+ }
+ else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
+ fileQueued(fileObj);
+ wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
+ }
+ else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
+ fileQueued(fileObj);
+ wpFileError(fileObj, swfuploadL10n.zero_byte_file);
+ }
+ else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
+ fileQueued(fileObj);
+ wpFileError(fileObj, swfuploadL10n.invalid_filetype);
+ }
+ else {
+ wpQueueError(swfuploadL10n.default_error);
+ }
+}
+
+function fileDialogComplete(num_files_queued) {
+ try {
+ if (num_files_queued > 0) {
+ this.startUpload();
+ }
+ } catch (ex) {
+ this.debug(ex);
+ }
+}
+
+function uploadError(fileObj, error_code, message) {
+ // first the file specific error
+ if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) {
+ wpFileError(fileObj, swfuploadL10n.missing_upload_url);
+ }
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) {
+ wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded);
+ }
+ else {
+ wpFileError(fileObj, swfuploadL10n.default_error);
+ }
+
+ // now the general upload status
+ if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) {
+ wpQueueError(swfuploadL10n.http_error);
+ }
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) {
+ wpQueueError(swfuploadL10n.upload_failed);
+ }
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) {
+ wpQueueError(swfuploadL10n.io_error);
+ }
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) {
+ wpQueueError(swfuploadL10n.security_error);
+ }
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) {
+ wpQueueError(swfuploadL10n.security_error);
+ }
+}
diff --git a/wp-includes/js/swfupload/plugins/swfupload.cookies.js b/wp-includes/js/swfupload/plugins/swfupload.cookies.js
new file mode 100644
index 0000000..4d41612
--- /dev/null
+++ b/wp-includes/js/swfupload/plugins/swfupload.cookies.js
@@ -0,0 +1,50 @@
+/*
+ Cookie Plug-in
+
+ This plug in automatically gets all the cookies for this site and adds them to the post_params.
+ Cookies are loaded only on initialization. The refreshCookies function can be called to update the post_params.
+ The cookies will override any other post params with the same name.
+*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+ SWFUpload.prototype.initSettings = function (old_initSettings) {
+ return function (init_settings) {
+ if (typeof(old_initSettings) === "function") {
+ old_initSettings.call(this, init_settings);
+ }
+
+ this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
+ };
+ }(SWFUpload.prototype.initSettings);
+
+ // refreshes the post_params and updates SWFUpload. The send_to_flash parameters is optional and defaults to True
+ SWFUpload.prototype.refreshCookies = function (send_to_flash) {
+ if (send_to_flash !== false) send_to_flash = true;
+
+ // Get the post_params object
+ var post_params = this.getSetting("post_params");
+
+ // Get the cookies
+ var i, cookie_array = document.cookie.split(';'), ca_length = cookie_array.length, c, eq_index, name, value;
+ for(i = 0; i < ca_length; i++) {
+ c = cookie_array[i];
+
+ // Left Trim spaces
+ while (c.charAt(0) == " ") {
+ c = c.substring(1, c.length);
+ }
+ eq_index = c.indexOf("=");
+ if (eq_index > 0) {
+ name = c.substring(0, eq_index);
+ value = c.substring(eq_index+1);
+ post_params[name] = value;
+ }
+ }
+
+ if (send_to_flash) {
+ this.setPostParams(post_params);
+ }
+ };
+
+}
diff --git a/wp-includes/js/swfupload/plugins/swfupload.documentready.js b/wp-includes/js/swfupload/plugins/swfupload.documentready.js
new file mode 100644
index 0000000..a95bac5
--- /dev/null
+++ b/wp-includes/js/swfupload/plugins/swfupload.documentready.js
@@ -0,0 +1,102 @@
+/*
+ DocumentReady Plug-in
+
+ This plugin loads SWFUpload as soon as the document is ready. You should not load SWFUpload inside window.onload using this plugin.
+ You can also chain other functions by calling SWFUpload.DocumentReady(your function).
+
+ Warning: Embedded Ads or other scripts that overwrite window.onload or use their own document ready functions may interfer with this plugin. You
+ should not set window.onload when using this plugin.
+
+ Usage Example:
+
+ var swfu = new SWFUpload(your settings object);
+ SWFUpload.DocumentReady(function () { alert('Document Ready!'; });
+
+*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+ // Override iniSWFUpload so SWFUpload gets inited when the document is ready rather than immediately
+ SWFUpload.prototype.initSWFUpload = function (old_initSWFUpload) {
+ return function (init_settings) {
+ var self = this;
+ if (typeof(old_initSWFUpload) === "function") {
+ SWFUpload.DocumentReady(function () {
+ old_initSWFUpload.call(self, init_settings);
+ });
+ }
+ }
+
+ }(SWFUpload.prototype.initSWFUpload);
+
+
+ // The DocumentReady function adds the passed in function to
+ // the functions that will be executed when the document is ready/loaded
+ SWFUpload.DocumentReady = function (fn) {
+ // Add the function to the chain
+ SWFUpload.DocumentReady.InternalOnloadChain = function (previous_link_fn) {
+ return function () {
+ if (typeof(previous_link_fn) === "function") {
+ previous_link_fn();
+ }
+ fn();
+ };
+ }(SWFUpload.DocumentReady.InternalOnloadChain);
+ };
+ SWFUpload.DocumentReady.InternalOnloadChain = null;
+ SWFUpload.DocumentReady.Onload = function () {
+ // Execute the onload function chain
+ if (typeof(SWFUpload.DocumentReady.InternalOnloadChain) === "function") {
+ SWFUpload.DocumentReady.InternalOnloadChain();
+ }
+ };
+ SWFUpload.DocumentReady.SetupComplete = false;
+
+
+ /* ********************************************
+ This portion of the code gets executed as soon it is loaded.
+ It binds the proper event for executing JavaScript is
+ early as possible. This is a per browser function and so
+ some browser sniffing is used.
+
+ This solution still has the "exposed" issue (See the Global Delegation section at http://peter.michaux.ca/article/553 )
+
+ Base solution from http://dean.edwards.name/weblog/2006/06/again/ and http://dean.edwards.name/weblog/2005/09/busted/
+ ******************************************** */
+ if (!SWFUpload.DocumentReady.SetupComplete) {
+ // for Internet Explorer (using conditional comments)
+ /*@cc_on @*/
+ /*@if (@_win32)
+ document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
+ var script = document.getElementById("__ie_onload");
+ script.onreadystatechange = function() {
+ if (this.readyState == "complete") {
+ SWFUpload.DocumentReady.Onload(); // call the onload handler
+ }
+ };
+ SWFUpload.DocumentReady.SetupComplete = true;
+ /*@end @*/
+ }
+
+ if (!SWFUpload.DocumentReady.SetupComplete && /WebKit/i.test(navigator.userAgent)) { // sniff
+ var _timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState)) {
+ clearInterval(_timer);
+ SWFUpload.DocumentReady.Onload(); // call the onload handler
+ }
+ }, 10);
+ SWFUpload.DocumentReady.SetupComplete = true;
+ }
+
+ /* for Mozilla */
+ if (!SWFUpload.DocumentReady.SetupComplete && document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", SWFUpload.DocumentReady.Onload, false);
+ SWFUpload.DocumentReady.SetupComplete = true;
+ }
+
+ /* for other browsers */
+ if (!SWFUpload.DocumentReady.SetupComplete) {
+ window.onload = SWFUpload.DocumentReady.Onload;
+ SWFUpload.DocumentReady.SetupComplete = true;
+ }
+}
diff --git a/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js b/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js
new file mode 100644
index 0000000..16bf12e
--- /dev/null
+++ b/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js
@@ -0,0 +1,63 @@
+/*
+ SWFUpload Graceful Degradation Plug-in
+
+ This plugin allows SWFUpload to display only if it is loaded successfully. Otherwise a default form is left displayed.
+
+ Usage:
+
+ To use this plugin create two HTML containers. Each should have an ID defined. One container should hold the SWFUpload UI. The other should hold the degraded UI.
+
+ The SWFUpload container should have its CSS "display" property set to "none".
+
+ If SWFUpload loads successfully the SWFUpload container will be displayed ("display" set to "block") and the
+ degraded container will be hidden ("display" set to "none").
+
+ Use the settings "swfupload_element_id" and "degraded_element_id" to indicate your container IDs. The default values are "swfupload_container" and "degraded_container".
+
+*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+ SWFUpload.gracefulDegradation = {};
+ SWFUpload.prototype.initSettings = function (old_initSettings) {
+ return function (init_settings) {
+ if (typeof(old_initSettings) === "function") {
+ old_initSettings.call(this, init_settings);
+ }
+
+ this.addSetting("swfupload_element_id", init_settings.swfupload_element_id, "swfupload_container");
+ this.addSetting("degraded_element_id", init_settings.degraded_element_id, "degraded_container");
+ this.addSetting("user_swfUploadLoaded_handler", init_settings.swfupload_loaded_handler, SWFUpload.swfUploadLoaded);
+
+ this.swfUploadLoaded_handler = SWFUpload.gracefulDegradation.swfUploadLoaded;
+ };
+ }(SWFUpload.prototype.initSettings);
+
+ SWFUpload.gracefulDegradation.swfUploadLoaded = function () {
+ var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
+ try {
+ swfupload_element_id = this.getSetting("swfupload_element_id");
+ degraded_element_id = this.getSetting("degraded_element_id");
+
+ // Show the UI container
+ swfupload_container = document.getElementById(swfupload_element_id);
+ if (swfupload_container !== null) {
+ swfupload_container.style.display = "block";
+
+ // Now take care of hiding the degraded UI
+ degraded_container = document.getElementById(degraded_element_id);
+ if (degraded_container !== null) {
+ degraded_container.style.display = "none";
+ }
+ }
+ } catch (ex) {
+ this.debug(ex);
+ }
+
+ user_swfUploadLoaded_handler = this.getSetting("user_swfUploadLoaded_handler");
+ if (typeof(user_swfUploadLoaded_handler) === "function") {
+ user_swfUploadLoaded_handler.apply(this);
+ }
+ };
+
+}
diff --git a/wp-includes/js/swfupload/plugins/swfupload.queue.js b/wp-includes/js/swfupload/plugins/swfupload.queue.js
new file mode 100644
index 0000000..9752e28
--- /dev/null
+++ b/wp-includes/js/swfupload/plugins/swfupload.queue.js
@@ -0,0 +1,58 @@
+/*
+ Queue Plug-in
+
+ Features:
+ cancelQueue method for cancelling the entire queue.
+ All queued files are uploaded when startUpload() is called.
+ If false is returned from uploadComplete then the queue upload is stopped. If false is not returned (strict comparison) then the queue upload is continued.
+
+ */
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+ SWFUpload.queue = {};
+
+ SWFUpload.prototype.initSettings = function (old_initSettings) {
+ return function (init_settings) {
+ if (typeof(old_initSettings) === "function") {
+ old_initSettings.call(this, init_settings);
+ }
+
+ this.customSettings.queue_cancelled_flag = false;
+
+ this.addSetting("user_upload_complete_handler", init_settings.upload_complete_handler, SWFUpload.uploadComplete);
+ this.uploadComplete_handler = SWFUpload.queue.uploadComplete;
+ };
+ }(SWFUpload.prototype.initSettings);
+
+ SWFUpload.prototype.cancelQueue = function () {
+ var stats = this.getStats();
+ this.customSettings.queue_cancelled_flag = false;
+
+ if (stats.in_progress > 0) {
+ this.customSettings.queue_cancelled_flag = true;
+ }
+
+ while(stats.files_queued > 0) {
+ this.cancelUpload();
+ stats = this.getStats();
+ }
+ };
+
+ SWFUpload.queue.uploadComplete = function (file) {
+ var user_upload_complete_handler = this.getSetting("user_upload_complete_handler");
+ var continue_upload = true;
+ if (typeof(user_upload_complete_handler) === "function") {
+ continue_upload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+ }
+
+ if (continue_upload) {
+ var stats = this.getStats();
+ if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
+ this.startUpload();
+ } else {
+ this.customSettings.queue_cancelled_flag = false;
+ }
+ }
+ };
+}
diff --git a/wp-includes/js/swfupload/swfupload.js b/wp-includes/js/swfupload/swfupload.js
new file mode 100644
index 0000000..583876f
--- /dev/null
+++ b/wp-includes/js/swfupload/swfupload.js
@@ -0,0 +1,1051 @@
+/**
+ * SWFUpload v2.0 by Jacob Roberts, Nov 2007, http://www.swfupload.org, http://linebyline.blogspot.com
+ * -------- -------- -------- -------- -------- -------- -------- --------
+ * SWFUpload is (c) 2006 Lars Huring and Mammon Media and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * See Changelog.txt for version history
+ *
+ * Development Notes:
+ * * This version of SWFUpload requires Flash Player 9.0.28 and should autodetect the correct flash version.
+ * * In Linux Flash Player 9 setting the post file variable name does not work. It is always set to "Filedata".
+ * * There is a lot of repeated code that could be refactored to single functions. Feel free.
+ * * It's dangerous to do "circular calls" between Flash and JavaScript. I've taken steps to try to work around issues
+ * by having the event calls pipe through setTimeout. However you should still avoid calling in to Flash from
+ * within the event handler methods. Especially the "startUpload" event since it cannot use the setTimeout hack.
+ */
+
+
+/* *********** */
+/* Constructor */
+/* *********** */
+
+var SWFUpload = function (init_settings) {
+ this.initSWFUpload(init_settings);
+};
+
+SWFUpload.prototype.initSWFUpload = function (init_settings) {
+ // Remove background flicker in IE (read this: http://misterpixel.blogspot.com/2006/09/forensic-analysis-of-ie6.html)
+ // This doesn't have anything to do with SWFUpload but can help your UI behave better in IE.
+ try {
+ document.execCommand('BackgroundImageCache', false, true);
+ } catch (ex1) {
+ }
+
+
+ try {
+ this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
+ this.settings = {};
+ this.eventQueue = [];
+ this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
+ this.movieElement = null;
+
+ // Setup global control tracking
+ SWFUpload.instances[this.movieName] = this;
+
+ // Load the settings. Load the Flash movie.
+ this.initSettings(init_settings);
+ this.loadFlash();
+
+ this.displayDebugInfo();
+
+ } catch (ex2) {
+ this.debug(ex2);
+ }
+}
+
+/* *************** */
+/* Static thingies */
+/* *************** */
+SWFUpload.instances = {};
+SWFUpload.movieCount = 0;
+SWFUpload.QUEUE_ERROR = {
+ QUEUE_LIMIT_EXCEEDED : -100,
+ FILE_EXCEEDS_SIZE_LIMIT : -110,
+ ZERO_BYTE_FILE : -120,
+ INVALID_FILETYPE : -130
+};
+SWFUpload.UPLOAD_ERROR = {
+ HTTP_ERROR : -200,
+ MISSING_UPLOAD_URL : -210,
+ IO_ERROR : -220,
+ SECURITY_ERROR : -230,
+ UPLOAD_LIMIT_EXCEEDED : -240,
+ UPLOAD_FAILED : -250,
+ SPECIFIED_FILE_ID_NOT_FOUND : -260,
+ FILE_VALIDATION_FAILED : -270,
+ FILE_CANCELLED : -280,
+ UPLOAD_STOPPED : -290
+};
+SWFUpload.FILE_STATUS = {
+ QUEUED : -1,
+ IN_PROGRESS : -2,
+ ERROR : -3,
+ COMPLETE : -4,
+ CANCELLED : -5
+};
+
+
+/* ***************** */
+/* Instance Thingies */
+/* ***************** */
+// init is a private method that ensures that all the object settings are set, getting a default value if one was not assigned.
+
+SWFUpload.prototype.initSettings = function (init_settings) {
+ // Upload backend settings
+ this.addSetting("upload_url", init_settings.upload_url, "");
+ this.addSetting("file_post_name", init_settings.file_post_name, "Filedata");
+ this.addSetting("post_params", init_settings.post_params, {});
+
+ // File Settings
+ this.addSetting("file_types", init_settings.file_types, "*.*");
+ this.addSetting("file_types_description", init_settings.file_types_description, "All Files");
+ this.addSetting("file_size_limit", init_settings.file_size_limit, "1024");
+ this.addSetting("file_upload_limit", init_settings.file_upload_limit, "0");
+ this.addSetting("file_queue_limit", init_settings.file_queue_limit, "0");
+
+ // Flash Settings
+ this.addSetting("flash_url", init_settings.flash_url, "swfupload.swf");
+ this.addSetting("flash_width", init_settings.flash_width, "1px");
+ this.addSetting("flash_height", init_settings.flash_height, "1px");
+ this.addSetting("flash_color", init_settings.flash_color, "#FFFFFF");
+
+ // Debug Settings
+ this.addSetting("debug_enabled", init_settings.debug, false);
+
+ // Event Handlers
+ this.flashReady_handler = SWFUpload.flashReady; // This is a non-overrideable event handler
+ this.swfUploadLoaded_handler = this.retrieveSetting(init_settings.swfupload_loaded_handler, SWFUpload.swfUploadLoaded);
+
+ this.fileDialogStart_handler = this.retrieveSetting(init_settings.file_dialog_start_handler, SWFUpload.fileDialogStart);
+ this.fileQueued_handler = this.retrieveSetting(init_settings.file_queued_handler, SWFUpload.fileQueued);
+ this.fileQueueError_handler = this.retrieveSetting(init_settings.file_queue_error_handler, SWFUpload.fileQueueError);
+ this.fileDialogComplete_handler = this.retrieveSetting(init_settings.file_dialog_complete_handler, SWFUpload.fileDialogComplete);
+
+ this.uploadStart_handler = this.retrieveSetting(init_settings.upload_start_handler, SWFUpload.uploadStart);
+ this.uploadProgress_handler = this.retrieveSetting(init_settings.upload_progress_handler, SWFUpload.uploadProgress);
+ this.uploadError_handler = this.retrieveSetting(init_settings.upload_error_handler, SWFUpload.uploadError);
+ this.uploadSuccess_handler = this.retrieveSetting(init_settings.upload_success_handler, SWFUpload.uploadSuccess);
+ this.uploadComplete_handler = this.retrieveSetting(init_settings.upload_complete_handler, SWFUpload.uploadComplete);
+
+ this.debug_handler = this.retrieveSetting(init_settings.debug_handler, SWFUpload.debug);
+
+ // Other settings
+ this.customSettings = this.retrieveSetting(init_settings.custom_settings, {});
+};
+
+// loadFlash is a private method that generates the HTML tag for the Flash
+// It then adds the flash to the "target" or to the body and stores a
+// reference to the flash element in "movieElement".
+SWFUpload.prototype.loadFlash = function () {
+ var html, target_element, container;
+
+ // Make sure an element with the ID we are going to use doesn't already exist
+ if (document.getElementById(this.movieName) !== null) {
+ return false;
+ }
+
+ // Get the body tag where we will be adding the flash movie
+ try {
+ target_element = document.getElementsByTagName("body")[0];
+ if (typeof(target_element) === "undefined" || target_element === null) {
+ this.debug('Could not find the BODY element. SWFUpload failed to load.');
+ return false;
+ }
+ } catch (ex) {
+ return false;
+ }
+
+ // Append the container and load the flash
+ container = document.createElement("div");
+ container.style.width = this.getSetting("flash_width");
+ container.style.height = this.getSetting("flash_height");
+
+ target_element.appendChild(container);
+ container.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
+};
+
+// Generates the embed/object tags needed to embed the flash in to the document
+SWFUpload.prototype.getFlashHTML = function () {
+ var html = "";
+
+ // Create Mozilla Embed HTML
+ if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
+ // Build the basic embed html
+ html = '<embed type="application/x-shockwave-flash" src="' + this.getSetting("flash_url") + '" width="' + this.getSetting("flash_width") + '" height="' + this.getSetting("flash_height") + '"';
+ html += ' id="' + this.movieName + '" name="' + this.movieName + '" ';
+ html += 'bgcolor="' + this.getSetting("flash_color") + '" quality="high" menu="false" flashvars="';
+
+ html += this.getFlashVars();
+
+ html += '" />';
+
+ // Create IE Object HTML
+ } else {
+
+ // Build the basic Object tag
+ html = '<object id="' + this.movieName + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.getSetting("flash_width") + '" height="' + this.getSetting("flash_height") + '">';
+ html += '<param name="movie" value="' + this.getSetting("flash_url") + '">';
+
+ html += '<param name="bgcolor" value="' + this.getSetting("flash_color") + '" />';
+ html += '<param name="quality" value="high" />';
+ html += '<param name="menu" value="false" />';
+
+ html += '<param name="flashvars" value="' + this.getFlashVars() + '" />';
+ html += '</object>';
+ }
+
+ return html;
+};
+
+// This private method builds the parameter string that will be passed
+// to flash.
+SWFUpload.prototype.getFlashVars = function () {
+ // Build a string from the post param object
+ var param_string = this.buildParamString();
+
+ // Build the parameter string
+ var html = "";
+ html += "movieName=" + encodeURIComponent(this.movieName);
+ html += "&uploadURL=" + encodeURIComponent(this.getSetting("upload_url"));
+ html += "&params=" + encodeURIComponent(param_string);
+ html += "&filePostName=" + encodeURIComponent(this.getSetting("file_post_name"));
+ html += "&fileTypes=" + encodeURIComponent(this.getSetting("file_types"));
+ html += "&fileTypesDescription=" + encodeURIComponent(this.getSetting("file_types_description"));
+ html += "&fileSizeLimit=" + encodeURIComponent(this.getSetting("file_size_limit"));
+ html += "&fileUploadLimit=" + encodeURIComponent(this.getSetting("file_upload_limit"));
+ html += "&fileQueueLimit=" + encodeURIComponent(this.getSetting("file_queue_limit"));
+ html += "&debugEnabled=" + encodeURIComponent(this.getSetting("debug_enabled"));
+
+ return html;
+};
+
+SWFUpload.prototype.getMovieElement = function () {
+ if (typeof(this.movieElement) === "undefined" || this.movieElement === null) {
+ this.movieElement = document.getElementById(this.movieName);
+
+ // Fix IEs "Flash can't callback when in a form" issue (http://www.extremefx.com.ar/blog/fixing-flash-external-interface-inside-form-on-internet-explorer)
+ // Removed because Revision 6 always adds the flash to the body (inside a containing div)
+ // If you insist on adding the Flash file inside a Form then in IE you have to make you wait until the DOM is ready
+ // and run this code to make the form's ID available from the window object so Flash and JavaScript can communicate.
+ //if (typeof(window[this.movieName]) === "undefined" || window[this.moveName] !== this.movieElement) {
+ // window[this.movieName] = this.movieElement;
+ //}
+ }
+
+ return this.movieElement;
+};
+
+SWFUpload.prototype.buildParamString = function () {
+ var post_params = this.getSetting("post_params");
+ var param_string_pairs = [];
+ var i, value, name;
+
+ // Retrieve the user defined parameters
+ if (typeof(post_params) === "object") {
+ for (name in post_params) {
+ if (post_params.hasOwnProperty(name)) {
+ if (typeof(post_params[name]) === "string") {
+ param_string_pairs.push(encodeURIComponent(name) + "=" + encodeURIComponent(post_params[name]));
+ }
+ }
+ }
+ }
+
+ return param_string_pairs.join("&");
+};
+
+// Saves a setting. If the value given is undefined or null then the default_value is used.
+SWFUpload.prototype.addSetting = function (name, value, default_value) {
+ if (typeof(value) === "undefined" || value === null) {
+ this.settings[name] = default_value;
+ } else {
+ this.settings[name] = value;
+ }
+
+ return this.settings[name];
+};
+
+// Gets a setting. Returns empty string if not found.
+SWFUpload.prototype.getSetting = function (name) {
+ if (typeof(this.settings[name]) === "undefined") {
+ return "";
+ } else {
+ return this.settings[name];
+ }
+};
+
+// Gets a setting, if the setting is undefined then return the default value
+// This does not affect or use the interal setting object.
+SWFUpload.prototype.retrieveSetting = function (value, default_value) {
+ if (typeof(value) === "undefined" || value === null) {
+ return default_value;
+ } else {
+ return value;
+ }
+};
+
+
+// It loops through all the settings and displays
+// them in the debug Console.
+SWFUpload.prototype.displayDebugInfo = function () {
+ var key, debug_message = "";
+
+ debug_message += "----- SWFUPLOAD SETTINGS ----\nID: " + this.moveName + "\n";
+
+ debug_message += this.outputObject(this.settings);
+
+ debug_message += "----- SWFUPLOAD SETTINGS END ----\n";
+ debug_message += "\n";
+
+ this.debug(debug_message);
+};
+SWFUpload.prototype.outputObject = function (object, prefix) {
+ var output = "", key;
+
+ if (typeof(prefix) !== "string") {
+ prefix = "";
+ }
+ if (typeof(object) !== "object") {
+ return "";
+ }
+
+ for (key in object) {
+ if (object.hasOwnProperty(key)) {
+ if (typeof(object[key]) === "object") {
+ output += (prefix + key + ": { \n" + this.outputObject(object[key], "\t" + prefix) + prefix + "}" + "\n");
+ } else {
+ output += (prefix + key + ": " + object[key] + "\n");
+ }
+ }
+ }
+
+ return output;
+};
+
+/* *****************************
+ -- Flash control methods --
+ Your UI should use these
+ to operate SWFUpload
+ ***************************** */
+
+SWFUpload.prototype.selectFile = function () {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SelectFile) === "function") {
+ try {
+ movie_element.SelectFile();
+ }
+ catch (ex) {
+ this.debug("Could not call SelectFile: " + ex);
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+
+};
+
+SWFUpload.prototype.selectFiles = function () {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SelectFiles) === "function") {
+ try {
+ movie_element.SelectFiles();
+ }
+ catch (ex) {
+ this.debug("Could not call SelectFiles: " + ex);
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+
+};
+
+
+/* Start the upload. If a file_id is specified that file is uploaded. Otherwise the first
+ * file in the queue is uploaded. If no files are in the queue then nothing happens.
+ * This call uses setTimeout since Flash will be calling back in to JavaScript
+ */
+SWFUpload.prototype.startUpload = function (file_id) {
+ var self = this;
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.StartUpload) === "function") {
+ setTimeout(
+ function () {
+ try {
+ movie_element.StartUpload(file_id);
+ }
+ catch (ex) {
+ self.debug("Could not call StartUpload: " + ex);
+ }
+ }, 0
+ );
+ } else {
+ this.debug("Could not find Flash element");
+ }
+
+};
+
+/* Cancels a the file upload. You must specify a file_id */
+SWFUpload.prototype.cancelUpload = function (file_id) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.CancelUpload) === "function") {
+ try {
+ movie_element.CancelUpload(file_id);
+ }
+ catch (ex) {
+ this.debug("Could not call CancelUpload: " + ex);
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+
+};
+
+// Stops the current upload. The file is re-queued. If nothing is currently uploading then nothing happens.
+SWFUpload.prototype.stopUpload = function () {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.StopUpload) === "function") {
+ try {
+ movie_element.StopUpload();
+ }
+ catch (ex) {
+ this.debug("Could not call StopUpload: " + ex);
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+
+};
+
+/* ************************
+ * Settings methods
+ * These methods change the settings inside SWFUpload
+ * They shouldn't need to be called in a setTimeout since they
+ * should not call back from Flash to JavaScript (except perhaps in a Debug call)
+ * and some need to return data so setTimeout won't work.
+ */
+
+/* Gets the file statistics object. It looks like this (where n = number):
+ {
+ files_queued: n,
+ complete_uploads: n,
+ upload_errors: n,
+ uploads_cancelled: n,
+ queue_errors: n
+ }
+*/
+SWFUpload.prototype.getStats = function () {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.GetStats) === "function") {
+ try {
+ return movie_element.GetStats();
+ }
+ catch (ex) {
+ this.debug("Could not call GetStats");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+};
+SWFUpload.prototype.setStats = function (stats_object) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetStats) === "function") {
+ try {
+ movie_element.SetStats(stats_object);
+ }
+ catch (ex) {
+ this.debug("Could not call SetStats");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+};
+
+SWFUpload.prototype.setCredentials = function(name, password) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetCredentials) === "function") {
+ try {
+ return movie_element.SetCredentials(name, password);
+ }
+ catch (ex) {
+ this.debug("Could not call SetCredentials");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+};
+
+SWFUpload.prototype.getFile = function (file_id) {
+ var movie_element = this.getMovieElement();
+ if (typeof(file_id) === "number") {
+ if (movie_element !== null && typeof(movie_element.GetFileByIndex) === "function") {
+ try {
+ return movie_element.GetFileByIndex(file_id);
+ }
+ catch (ex) {
+ this.debug("Could not call GetFileByIndex");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+ } else {
+ if (movie_element !== null && typeof(movie_element.GetFile) === "function") {
+ try {
+ return movie_element.GetFile(file_id);
+ }
+ catch (ex) {
+ this.debug("Could not call GetFile");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+ }
+};
+
+SWFUpload.prototype.addFileParam = function (file_id, name, value) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.AddFileParam) === "function") {
+ try {
+ return movie_element.AddFileParam(file_id, name, value);
+ }
+ catch (ex) {
+ this.debug("Could not call AddFileParam");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+};
+
+SWFUpload.prototype.removeFileParam = function (file_id, name) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.RemoveFileParam) === "function") {
+ try {
+ return movie_element.RemoveFileParam(file_id, name);
+ }
+ catch (ex) {
+ this.debug("Could not call AddFileParam");
+ }
+ } else {
+ this.debug("Could not find Flash element");
+ }
+
+};
+
+SWFUpload.prototype.setUploadURL = function (url) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetUploadURL) === "function") {
+ try {
+ this.addSetting("upload_url", url);
+ movie_element.SetUploadURL(this.getSetting("upload_url"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetUploadURL");
+ }
+ } else {
+ this.debug("Could not find Flash element in setUploadURL");
+ }
+};
+
+SWFUpload.prototype.setPostParams = function (param_object) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetPostParams) === "function") {
+ try {
+ this.addSetting("post_params", param_object);
+ movie_element.SetPostParams(this.getSetting("post_params"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetPostParams");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetPostParams");
+ }
+};
+
+SWFUpload.prototype.setFileTypes = function (types, description) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetFileTypes) === "function") {
+ try {
+ this.addSetting("file_types", types);
+ this.addSetting("file_types_description", description);
+ movie_element.SetFileTypes(this.getSetting("file_types"), this.getSetting("file_types_description"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetFileTypes");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetFileTypes");
+ }
+};
+
+SWFUpload.prototype.setFileSizeLimit = function (file_size_limit) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetFileSizeLimit) === "function") {
+ try {
+ this.addSetting("file_size_limit", file_size_limit);
+ movie_element.SetFileSizeLimit(this.getSetting("file_size_limit"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetFileSizeLimit");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetFileSizeLimit");
+ }
+};
+
+SWFUpload.prototype.setFileUploadLimit = function (file_upload_limit) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetFileUploadLimit) === "function") {
+ try {
+ this.addSetting("file_upload_limit", file_upload_limit);
+ movie_element.SetFileUploadLimit(this.getSetting("file_upload_limit"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetFileUploadLimit");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetFileUploadLimit");
+ }
+};
+
+SWFUpload.prototype.setFileQueueLimit = function (file_queue_limit) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetFileQueueLimit) === "function") {
+ try {
+ this.addSetting("file_queue_limit", file_queue_limit);
+ movie_element.SetFileQueueLimit(this.getSetting("file_queue_limit"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetFileQueueLimit");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetFileQueueLimit");
+ }
+};
+
+SWFUpload.prototype.setFilePostName = function (file_post_name) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetFilePostName) === "function") {
+ try {
+ this.addSetting("file_post_name", file_post_name);
+ movie_element.SetFilePostName(this.getSetting("file_post_name"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetFilePostName");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetFilePostName");
+ }
+};
+
+SWFUpload.prototype.setDebugEnabled = function (debug_enabled) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.SetDebugEnabled) === "function") {
+ try {
+ this.addSetting("debug_enabled", debug_enabled);
+ movie_element.SetDebugEnabled(this.getSetting("debug_enabled"));
+ }
+ catch (ex) {
+ this.debug("Could not call SetDebugEnabled");
+ }
+ } else {
+ this.debug("Could not find Flash element in SetDebugEnabled");
+ }
+};
+
+/* *******************************
+ Internal Event Callers
+ Don't override these! These event callers ensure that your custom event handlers
+ are called safely and in order.
+******************************* */
+
+/* This is the callback method that the Flash movie will call when it has been loaded and is ready to go.
+ Calling this or showUI() "manually" will bypass the Flash Detection built in to SWFUpload.
+ Use a ui_function setting if you want to control the UI loading after the flash has loaded.
+*/
+SWFUpload.prototype.flashReady = function () {
+ // Check that the movie element is loaded correctly with its ExternalInterface methods defined
+ var movie_element = this.getMovieElement();
+ if (movie_element === null || typeof(movie_element.StartUpload) !== "function") {
+ this.debug("ExternalInterface methods failed to initialize.");
+ return;
+ }
+
+ var self = this;
+ if (typeof(self.flashReady_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.flashReady_handler(); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("flashReady_handler event not defined");
+ }
+};
+
+/*
+ Event Queue. Rather can call events directly from Flash they events are
+ are placed in a queue and then executed. This ensures that each event is
+ executed in the order it was called which is not guarenteed when calling
+ setTimeout. Out of order events was especially problematic in Safari.
+*/
+SWFUpload.prototype.executeNextEvent = function () {
+ var f = this.eventQueue.shift();
+ if (typeof(f) === "function") {
+ f();
+ }
+}
+
+/* This is a chance to do something before the browse window opens */
+SWFUpload.prototype.fileDialogStart = function () {
+ var self = this;
+ if (typeof(self.fileDialogStart_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.fileDialogStart_handler(); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("fileDialogStart event not defined");
+ }
+};
+
+
+/* Called when a file is successfully added to the queue. */
+SWFUpload.prototype.fileQueued = function (file) {
+ var self = this;
+ if (typeof(self.fileQueued_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.fileQueued_handler(file); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("fileQueued event not defined");
+ }
+};
+
+
+/* Handle errors that occur when an attempt to queue a file fails. */
+SWFUpload.prototype.fileQueueError = function (file, error_code, message) {
+ var self = this;
+ if (typeof(self.fileQueueError_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.fileQueueError_handler(file, error_code, message); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("fileQueueError event not defined");
+ }
+};
+
+/* Called after the file dialog has closed and the selected files have been queued.
+ You could call startUpload here if you want the queued files to begin uploading immediately. */
+SWFUpload.prototype.fileDialogComplete = function (num_files_selected) {
+ var self = this;
+ if (typeof(self.fileDialogComplete_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.fileDialogComplete_handler(num_files_selected); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("fileDialogComplete event not defined");
+ }
+};
+
+/* Gets called when a file upload is about to be started. Return true to continue the upload. Return false to stop the upload.
+ If you return false then uploadError and uploadComplete are called (like normal).
+
+ This is a good place to do any file validation you need.
+ */
+SWFUpload.prototype.uploadStart = function (file) {
+ var self = this;
+ if (typeof(self.fileDialogComplete_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.returnUploadStart(self.uploadStart_handler(file)); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("uploadStart event not defined");
+ }
+};
+
+/* Note: Internal use only. This function returns the result of uploadStart to
+ flash. Since returning values in the normal way can result in Flash/JS circular
+ call issues we split up the call in a Timeout. This is transparent from the API
+ point of view.
+*/
+SWFUpload.prototype.returnUploadStart = function (return_value) {
+ var movie_element = this.getMovieElement();
+ if (movie_element !== null && typeof(movie_element.ReturnUploadStart) === "function") {
+ try {
+ movie_element.ReturnUploadStart(return_value);
+ }
+ catch (ex) {
+ this.debug("Could not call ReturnUploadStart");
+ }
+ } else {
+ this.debug("Could not find Flash element in returnUploadStart");
+ }
+};
+
+
+
+/* Called during upload as the file progresses. Use this event to update your UI. */
+SWFUpload.prototype.uploadProgress = function (file, bytes_complete, bytes_total) {
+ var self = this;
+ if (typeof(self.uploadProgress_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.uploadProgress_handler(file, bytes_complete, bytes_total); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("uploadProgress event not defined");
+ }
+};
+
+/* Called when an error occurs during an upload. Use error_code and the SWFUpload.UPLOAD_ERROR constants to determine
+ which error occurred. The uploadComplete event is called after an error code indicating that the next file is
+ ready for upload. For files cancelled out of order the uploadComplete event will not be called. */
+SWFUpload.prototype.uploadError = function (file, error_code, message) {
+ var self = this;
+ if (typeof(this.uploadError_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.uploadError_handler(file, error_code, message); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("uploadError event not defined");
+ }
+};
+
+/* This gets called when a file finishes uploading and the server-side upload script has completed and returned a 200
+status code. Any text returned by the server is available in server_data.
+**NOTE: The upload script MUST return some text or the uploadSuccess and uploadComplete events will not fire and the
+upload will become 'stuck'. */
+SWFUpload.prototype.uploadSuccess = function (file, server_data) {
+ var self = this;
+ if (typeof(self.uploadSuccess_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.uploadSuccess_handler(file, server_data); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("uploadSuccess event not defined");
+ }
+};
+
+/* uploadComplete is called when the file is uploaded or an error occurred and SWFUpload is ready to make the next upload.
+ If you want the next upload to start to automatically you can call startUpload() from this event. */
+SWFUpload.prototype.uploadComplete = function (file) {
+ var self = this;
+ if (typeof(self.uploadComplete_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.uploadComplete_handler(file); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.debug("uploadComplete event not defined");
+ }
+};
+
+/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
+ internal debug console. You can override this event and have messages written where you want. */
+SWFUpload.prototype.debug = function (message) {
+ var self = this;
+ if (typeof(self.debug_handler) === "function") {
+ this.eventQueue[this.eventQueue.length] = function() { self.debug_handler(message); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ } else {
+ this.eventQueue[this.eventQueue.length] = function() { self.debugMessage(message); };
+ setTimeout(function () { self.executeNextEvent();}, 0);
+ }
+};
+
+
+/* **********************************
+ Default Event Handlers.
+ These event handlers are used by default if an overriding handler is
+ not defined in the SWFUpload settings object.
+
+ JS Note: even though these are defined on the SWFUpload object (rather than the prototype) they
+ are attached (read: copied) to a SWFUpload instance and 'this' is given the proper context.
+ ********************************** */
+
+/* This is a special event handler that has no override in the settings. Flash calls this when it has
+ been loaded by the browser and is ready for interaction. You should not override it. If you need
+ to do something with SWFUpload has loaded then use the swfupload_loaded_handler setting.
+*/
+SWFUpload.flashReady = function () {
+ try {
+ this.debug("Flash called back and is ready.");
+
+ if (typeof(this.swfUploadLoaded_handler) === "function") {
+ this.swfUploadLoaded_handler();
+ }
+ } catch (ex) {
+ this.debug(ex);
+ }
+};
+
+/* This is a chance to something immediately after SWFUpload has loaded.
+ Like, hide the default/degraded upload form and display the SWFUpload form. */
+SWFUpload.swfUploadLoaded = function () {
+};
+
+/* This is a chance to do something before the browse window opens */
+SWFUpload.fileDialogStart = function () {
+};
+
+
+/* Called when a file is successfully added to the queue. */
+SWFUpload.fileQueued = function (file) {
+};
+
+
+/* Handle errors that occur when an attempt to queue a file fails. */
+SWFUpload.fileQueueError = function (file, error_code, message) {
+ try {
+ switch (error_code) {
+ case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
+ this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+ break;
+ case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
+ this.debug("Error Code: Zero Byte File, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+ break;
+ case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
+ this.debug("Error Code: Upload limit reached, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+ break;
+ case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
+ this.debug("Error Code: File extension is not allowed, Message: " + message);
+ break;
+ default:
+ this.debug("Error Code: Unhandled error occured. Errorcode: " + error_code);
+ }
+ } catch (ex) {
+ this.debug(ex);
+ }
+};
+
+/* Called after the file dialog has closed and the selected files have been queued.
+ You could call startUpload here if you want the queued files to begin uploading immediately. */
+SWFUpload.fileDialogComplete = function (num_files_selected) {
+};
+
+/* Gets called when a file upload is about to be started. Return true to continue the upload. Return false to stop the upload.
+ If you return false then the uploadError callback is called and then uploadComplete (like normal).
+
+ This is a good place to do any file validation you need.
+
+ This is the only function that cannot be called on a setTimeout because it must return a value to Flash.
+ You SHOULD NOT make any calls in to Flash (e.i, changing settings, getting stats, etc). Flash Player bugs prevent
+ calls in to Flash from working reliably.
+*/
+SWFUpload.uploadStart = function (file) {
+ return true;
+};
+
+// Called during upload as the file progresses
+SWFUpload.uploadProgress = function (file, bytes_complete, bytes_total) {
+ this.debug("File Progress: " + file.id + ", Bytes: " + bytes_complete + ". Total: " + bytes_total);
+};
+
+/* This gets called when a file finishes uploading and the upload script has completed and returned a 200 status code. Any text returned by the
+server is available in server_data. The upload script must return some text or uploadSuccess will not fire (neither will uploadComplete). */
+SWFUpload.uploadSuccess = function (file, server_data) {
+ this.debug("Upload Success: " + file.id + ", Server: " + server_data);
+};
+
+/* This is called last. The file is uploaded or an error occurred and SWFUpload is ready to make the next upload.
+ If you want to automatically start the next file just call startUpload from here.
+*/
+SWFUpload.uploadComplete = function (file) {
+ this.debug("Upload Complete: " + file.id);
+};
+
+// Called by SWFUpload JavaScript and Flash functions when debug is enabled.
+// Override this method in your settings to call your own debug message handler
+SWFUpload.debug = function (message) {
+ if (this.getSetting("debug_enabled")) {
+ this.debugMessage(message);
+ }
+};
+
+/* Called when an upload occurs during upload. For HTTP errors 'message' will contain the HTTP STATUS CODE */
+SWFUpload.uploadError = function (file, errcode, msg) {
+ try {
+ switch (errcode) {
+ case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
+ this.debug("Error Code: File ID specified for upload was not found, Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+ this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
+ this.debug("Error Code: No backend file, File name: " + file.name + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+ this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
+ this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
+ this.debug("Error Code: Upload limit reached, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
+ this.debug("Error Code: Upload Initialization exception, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
+ this.debug("Error Code: uploadStart callback returned false, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
+ this.debug("Error Code: The file upload was cancelled, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
+ break;
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
+ this.debug("Error Code: The file upload was stopped, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
+ break;
+ default:
+ this.debug("Error Code: Unhandled error occured. Errorcode: " + errcode);
+ }
+ } catch (ex) {
+ this.debug(ex);
+ }
+};
+
+
+
+/* **********************************
+ Debug Console
+ The debug console is a self contained, in page location
+ for debug message to be sent. The Debug Console adds
+ itself to the body if necessary.
+
+ The console is automatically scrolled as messages appear.
+
+ You can override this console (to use FireBug's console for instance) by setting the debug event method to your own function
+ that handles the debug message
+ ********************************** */
+SWFUpload.prototype.debugMessage = function (message) {
+ var exception_message, exception_values;
+
+ if (typeof(message) === "object" && typeof(message.name) === "string" && typeof(message.message) === "string") {
+ exception_message = "";
+ exception_values = [];
+ for (var key in message) {
+ exception_values.push(key + ": " + message[key]);
+ }
+ exception_message = exception_values.join("\n");
+ exception_values = exception_message.split("\n");
+ exception_message = "EXCEPTION: " + exception_values.join("\nEXCEPTION: ");
+ SWFUpload.Console.writeLine(exception_message);
+ } else {
+ SWFUpload.Console.writeLine(message);
+ }
+};
+
+SWFUpload.Console = {};
+SWFUpload.Console.writeLine = function (message) {
+ var console, documentForm;
+
+ try {
+ console = document.getElementById("SWFUpload_Console");
+
+ if (!console) {
+ documentForm = document.createElement("form");
+ document.getElementsByTagName("body")[0].appendChild(documentForm);
+
+ console = document.createElement("textarea");
+ console.id = "SWFUpload_Console";
+ console.style.fontFamily = "monospace";
+ console.setAttribute("wrap", "off");
+ console.wrap = "off";
+ console.style.overflow = "auto";
+ console.style.width = "700px";
+ console.style.height = "350px";
+ console.style.margin = "5px";
+ documentForm.appendChild(console);
+ }
+
+ console.value += message + "\n";
+
+ console.scrollTop = console.scrollHeight - console.clientHeight;
+ } catch (ex) {
+ alert("Exception: " + ex.name + " Message: " + ex.message);
+ }
+};
diff --git a/wp-includes/js/swfupload/swfupload_f9.swf b/wp-includes/js/swfupload/swfupload_f9.swf
new file mode 100644
index 0000000..2aba003
--- /dev/null
+++ b/wp-includes/js/swfupload/swfupload_f9.swf
Binary files differ
diff --git a/wp-includes/js/thickbox/loadingAnimation.gif b/wp-includes/js/thickbox/loadingAnimation.gif
new file mode 100644
index 0000000..82290f4
--- /dev/null
+++ b/wp-includes/js/thickbox/loadingAnimation.gif
Binary files differ
diff --git a/wp-includes/js/thickbox/tb-close.png b/wp-includes/js/thickbox/tb-close.png
new file mode 100644
index 0000000..6a48f46
--- /dev/null
+++ b/wp-includes/js/thickbox/tb-close.png
Binary files differ
diff --git a/wp-includes/js/thickbox/thickbox.css b/wp-includes/js/thickbox/thickbox.css
new file mode 100644
index 0000000..0552cc5
--- /dev/null
+++ b/wp-includes/js/thickbox/thickbox.css
@@ -0,0 +1,159 @@
+
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+#TB_window {
+ font: 12px Arial, Helvetica, sans-serif;
+ color: #333333;
+}
+
+#TB_secondLine {
+ font: 10px Arial, Helvetica, sans-serif;
+ color:#666666;
+}
+
+#TB_window a:link {color: #666666;}
+#TB_window a:visited {color: #666666;}
+#TB_window a:hover {color: #000;}
+#TB_window a:active {color: #666666;}
+#TB_window a:focus{color: #666666;}
+
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+#TB_overlay {
+ position: fixed;
+ z-index:100;
+ top: 0px;
+ left: 0px;
+ height:100%;
+ width:100%;
+}
+
+.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
+.TB_overlayBG {
+ background-color:#000;
+ filter:alpha(opacity=75);
+ -moz-opacity: 0.75;
+ opacity: 0.75;
+}
+
+* html #TB_overlay { /* ie6 hack */
+ position: absolute;
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_window {
+ position: fixed;
+ background: #ffffff;
+ z-index: 102;
+ color:#000000;
+ display:none;
+ border: 4px solid #525252;
+ text-align:left;
+ top:50%;
+ left:50%;
+}
+
+* html #TB_window { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+}
+
+#TB_window img#TB_Image {
+ display:block;
+ margin: 15px 0 0 15px;
+ border-right: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+ border-top: 1px solid #666;
+ border-left: 1px solid #666;
+}
+
+#TB_caption{
+ height:25px;
+ padding:7px 30px 10px 25px;
+ float:left;
+}
+
+#TB_closeWindow{
+ height:25px;
+ padding:11px 25px 10px 0;
+ float:right;
+}
+
+#TB_closeAjaxWindow{
+ padding:7px 10px 5px 0;
+ margin-bottom:1px;
+ text-align:right;
+ float:right;
+}
+
+#TB_ajaxWindowTitle{
+ float:left;
+ padding:7px 0 5px 10px;
+ margin-bottom:1px;
+}
+
+#TB_title{
+ background-color:#e8e8e8;
+ height:27px;
+}
+
+#TB_ajaxContent{
+ clear:both;
+ padding:2px 15px 15px 15px;
+ overflow:auto;
+ text-align:left;
+ line-height:1.4em;
+}
+
+#TB_ajaxContent.TB_modal{
+ padding:15px;
+}
+
+#TB_ajaxContent p{
+ padding:5px 0px 5px 0px;
+}
+
+#TB_load{
+ position: fixed;
+ display:none;
+ height:13px;
+ width:208px;
+ z-index:103;
+ top: 50%;
+ left: 50%;
+ margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+}
+
+* html #TB_load { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+}
+
+#TB_HideSelect{
+ z-index:99;
+ position:fixed;
+ top: 0;
+ left: 0;
+ background-color:#fff;
+ border:none;
+ filter:alpha(opacity=0);
+ -moz-opacity: 0;
+ opacity: 0;
+ height:100%;
+ width:100%;
+}
+
+* html #TB_HideSelect { /* ie6 hack */
+ position: absolute;
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_iframeContent{
+ clear:both;
+ border:none;
+ margin-bottom:-1px;
+ margin-top:1px;
+ _margin-bottom:1px;
+}
diff --git a/wp-includes/js/thickbox/thickbox.js b/wp-includes/js/thickbox/thickbox.js
new file mode 100644
index 0000000..f31d779
--- /dev/null
+++ b/wp-includes/js/thickbox/thickbox.js
@@ -0,0 +1,320 @@
+/*
+ * Thickbox 3.1 - One Box To Rule Them All.
+ * By Cody Lindley (http://www.codylindley.com)
+ * Copyright (c) 2007 cody lindley
+ * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
+*/
+
+var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif";
+var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";
+
+/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
+
+//on page load call tb_init
+addLoadEvent(function(){
+ tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
+ imgLoader = new Image();// preload image
+ imgLoader.src = tb_pathToImage;
+});
+
+//add thickbox to href & area elements that have a class of .thickbox
+function tb_init(domChunk){
+ jQuery(domChunk).click(function(){
+ var t = this.title || this.name || null;
+ var a = this.href || this.alt;
+ var g = this.rel || false;
+ tb_show(t,a,g);
+ this.blur();
+ return false;
+ });
+}
+
+function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
+
+ try {
+ if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
+ jQuery("body","html").css({height: "100%", width: "100%"});
+ jQuery("html").css("overflow","hidden");
+ if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
+ jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
+ jQuery("#TB_overlay").click(tb_remove);
+ }
+ }else{//all others
+ if(document.getElementById("TB_overlay") === null){
+ jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
+ jQuery("#TB_overlay").click(tb_remove);
+ }
+ }
+
+ if(tb_detectMacXFF()){
+ jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
+ }else{
+ jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
+ }
+
+ if(caption===null){caption="";}
+ jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
+ jQuery('#TB_load').show();//show loader
+
+ var baseURL;
+ if(url.indexOf("?")!==-1){ //ff there is a query string involved
+ baseURL = url.substr(0, url.indexOf("?"));
+ }else{
+ baseURL = url;
+ }
+
+ var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
+ var urlType = baseURL.toLowerCase().match(urlString);
+
+ if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
+
+ TB_PrevCaption = "";
+ TB_PrevURL = "";
+ TB_PrevHTML = "";
+ TB_NextCaption = "";
+ TB_NextURL = "";
+ TB_NextHTML = "";
+ TB_imageCount = "";
+ TB_FoundURL = false;
+ if(imageGroup){
+ TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
+ for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
+ var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
+ if (!(TB_TempArray[TB_Counter].href == url)) {
+ if (TB_FoundURL) {
+ TB_NextCaption = TB_TempArray[TB_Counter].title;
+ TB_NextURL = TB_TempArray[TB_Counter].href;
+ TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
+ } else {
+ TB_PrevCaption = TB_TempArray[TB_Counter].title;
+ TB_PrevURL = TB_TempArray[TB_Counter].href;
+ TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
+ }
+ } else {
+ TB_FoundURL = true;
+ TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
+ }
+ }
+ }
+
+ imgPreloader = new Image();
+ imgPreloader.onload = function(){
+ imgPreloader.onload = null;
+
+ // Resizing large images - orginal by Christian Montoya edited by me.
+ var pagesize = tb_getPageSize();
+ var x = pagesize[0] - 150;
+ var y = pagesize[1] - 150;
+ var imageWidth = imgPreloader.width;
+ var imageHeight = imgPreloader.height;
+ if (imageWidth > x) {
+ imageHeight = imageHeight * (x / imageWidth);
+ imageWidth = x;
+ if (imageHeight > y) {
+ imageWidth = imageWidth * (y / imageHeight);
+ imageHeight = y;
+ }
+ } else if (imageHeight > y) {
+ imageWidth = imageWidth * (y / imageHeight);
+ imageHeight = y;
+ if (imageWidth > x) {
+ imageHeight = imageHeight * (x / imageWidth);
+ imageWidth = x;
+ }
+ }
+ // End Resizing
+
+ TB_WIDTH = imageWidth + 30;
+ TB_HEIGHT = imageHeight + 60;
+ jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div>");
+
+ jQuery("#TB_closeWindowButton").click(tb_remove);
+
+ if (!(TB_PrevHTML === "")) {
+ function goPrev(){
+ if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
+ jQuery("#TB_window").remove();
+ jQuery("body").append("<div id='TB_window'></div>");
+ tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
+ return false;
+ }
+ jQuery("#TB_prev").click(goPrev);
+ }
+
+ if (!(TB_NextHTML === "")) {
+ function goNext(){
+ jQuery("#TB_window").remove();
+ jQuery("body").append("<div id='TB_window'></div>");
+ tb_show(TB_NextCaption, TB_NextURL, imageGroup);
+ return false;
+ }
+ jQuery("#TB_next").click(goNext);
+
+ }
+
+ document.onkeydown = function(e){
+ if (e == null) { // ie
+ keycode = event.keyCode;
+ } else { // mozilla
+ keycode = e.which;
+ }
+ if(keycode == 27){ // close
+ tb_remove();
+ } else if(keycode == 190){ // display previous image
+ if(!(TB_NextHTML == "")){
+ document.onkeydown = "";
+ goNext();
+ }
+ } else if(keycode == 188){ // display next image
+ if(!(TB_PrevHTML == "")){
+ document.onkeydown = "";
+ goPrev();
+ }
+ }
+ };
+
+ tb_position();
+ jQuery("#TB_load").remove();
+ jQuery("#TB_ImageOff").click(tb_remove);
+ jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
+ };
+
+ imgPreloader.src = url;
+ }else{//code to show html
+
+ var queryString = url.replace(/^[^\?]+\??/,'');
+ var params = tb_parseQuery( queryString );
+
+ TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
+ TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
+ ajaxContentW = TB_WIDTH - 30;
+ ajaxContentH = TB_HEIGHT - 45;
+
+ if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
+ urlNoQuery = url.split('TB_');
+ jQuery("#TB_iframeContent").remove();
+ if(params['modal'] != "true"){//iframe no modal
+ jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
+ }else{//iframe modal
+ jQuery("#TB_overlay").unbind();
+ jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
+ }
+ }else{// not an iframe, ajax
+ if(jQuery("#TB_window").css("display") != "block"){
+ if(params['modal'] != "true"){//ajax no modal
+ jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src='" + tb_closeImage + "' /></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
+ }else{//ajax modal
+ jQuery("#TB_overlay").unbind();
+ jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
+ }
+ }else{//this means the window is already up, we are just loading new content via ajax
+ jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
+ jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
+ jQuery("#TB_ajaxContent")[0].scrollTop = 0;
+ jQuery("#TB_ajaxWindowTitle").html(caption);
+ }
+ }
+
+ jQuery("#TB_closeWindowButton").click(tb_remove);
+
+ if(url.indexOf('TB_inline') != -1){
+ jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
+ jQuery("#TB_window").unload(function () {
+ jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
+ });
+ tb_position();
+ jQuery("#TB_load").remove();
+ jQuery("#TB_window").css({display:"block"});
+ }else if(url.indexOf('TB_iframe') != -1){
+ tb_position();
+ if($.browser.safari){//safari needs help because it will not fire iframe onload
+ jQuery("#TB_load").remove();
+ jQuery("#TB_window").css({display:"block"});
+ }
+ }else{
+ jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
+ tb_position();
+ jQuery("#TB_load").remove();
+ tb_init("#TB_ajaxContent a.thickbox");
+ jQuery("#TB_window").css({display:"block"});
+ });
+ }
+
+ }
+
+ if(!params['modal']){
+ document.onkeyup = function(e){
+ if (e == null) { // ie
+ keycode = event.keyCode;
+ } else { // mozilla
+ keycode = e.which;
+ }
+ if(keycode == 27){ // close
+ tb_remove();
+ }
+ };
+ }
+
+ } catch(e) {
+ //nothing here
+ }
+}
+
+//helper functions below
+function tb_showIframe(){
+ jQuery("#TB_load").remove();
+ jQuery("#TB_window").css({display:"block"});
+}
+
+function tb_remove() {
+ jQuery("#TB_imageOff").unbind("click");
+ jQuery("#TB_closeWindowButton").unbind("click");
+ jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
+ jQuery("#TB_load").remove();
+ if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
+ jQuery("body","html").css({height: "auto", width: "auto"});
+ jQuery("html").css("overflow","");
+ }
+ document.onkeydown = "";
+ document.onkeyup = "";
+ return false;
+}
+
+function tb_position() {
+jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
+ if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
+ jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
+ }
+}
+
+function tb_parseQuery ( query ) {
+ var Params = {};
+ if ( ! query ) {return Params;}// return empty object
+ var Pairs = query.split(/[;&]/);
+ for ( var i = 0; i < Pairs.length; i++ ) {
+ var KeyVal = Pairs[i].split('=');
+ if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
+ var key = unescape( KeyVal[0] );
+ var val = unescape( KeyVal[1] );
+ val = val.replace(/\+/g, ' ');
+ Params[key] = val;
+ }
+ return Params;
+}
+
+function tb_getPageSize(){
+ var de = document.documentElement;
+ var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
+ var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
+ arrayPageSize = [w,h];
+ return arrayPageSize;
+}
+
+function tb_detectMacXFF() {
+ var userAgent = navigator.userAgent.toLowerCase();
+ if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
+ return true;
+ }
+}
+
+
diff --git a/wp-includes/js/tinymce/langs/en.js b/wp-includes/js/tinymce/langs/en.js
deleted file mode 100644
index c093eaf..0000000
--- a/wp-includes/js/tinymce/langs/en.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-bold_desc : 'Bold (Ctrl+B)',
-italic_desc : 'Italic (Ctrl+I)',
-underline_desc : 'Underline (Ctrl+U)',
-striketrough_desc : 'Strikethrough',
-justifyleft_desc : 'Align left',
-justifycenter_desc : 'Align center',
-justifyright_desc : 'Align right',
-justifyfull_desc : 'Align full',
-bullist_desc : 'Unordered list',
-numlist_desc : 'Ordered list',
-outdent_desc : 'Outdent',
-indent_desc : 'Indent',
-undo_desc : 'Undo (Ctrl+Z)',
-redo_desc : 'Redo (Ctrl+Y)',
-link_desc : 'Insert/edit link',
-unlink_desc : 'Unlink',
-image_desc : 'Insert/edit image',
-cleanup_desc : 'Cleanup messy code',
-focus_alert : 'A editor instance must be focused before using this command.',
-edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
-insert_link_title : 'Insert/edit link',
-insert : 'Insert',
-update : 'Update',
-cancel : 'Cancel',
-insert_link_url : 'Link URL',
-insert_link_target : 'Target',
-insert_link_target_same : 'Open link in the same window',
-insert_link_target_blank : 'Open link in a new window',
-insert_image_title : 'Insert/edit image',
-insert_image_src : 'Image URL',
-insert_image_alt : 'Image description',
-help_desc : 'Help',
-bold_img : "bold.gif",
-italic_img : "italic.gif",
-underline_img : "underline.gif",
-clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
-popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
-});
diff --git a/wp-includes/js/tinymce/langs/wp-langs.php b/wp-includes/js/tinymce/langs/wp-langs.php
new file mode 100644
index 0000000..39d2e51
--- /dev/null
+++ b/wp-includes/js/tinymce/langs/wp-langs.php
@@ -0,0 +1,400 @@
+<?php
+
+// escape text only if it needs translating
+function mce_escape($text) {
+ global $language;
+
+ if ( 'en' == $language ) return $text;
+ else return js_escape($text);
+}
+
+$strings = 'tinyMCE.addI18n({' . $language . ':{
+common:{
+edit_confirm:"' . mce_escape( __('Do you want to use the WYSIWYG mode for this textarea?') ) . '",
+apply:"' . mce_escape( __('Apply') ) . '",
+insert:"' . mce_escape( __('Insert') ) . '",
+update:"' . mce_escape( __('Update') ) . '",
+cancel:"' . mce_escape( __('Cancel') ) . '",
+close:"' . mce_escape( __('Close') ) . '",
+browse:"' . mce_escape( __('Browse') ) . '",
+class_name:"' . mce_escape( __('Class') ) . '",
+not_set:"' . mce_escape( __('-- Not set --') ) . '",
+clipboard_msg:"' . mce_escape( __('Copy/Cut/Paste is not available in Mozilla and Firefox.') ) . '",
+clipboard_no_support:"' . mce_escape( __('Currently not supported by your browser, use keyboard shortcuts instead.') ) . '",
+popup_blocked:"' . mce_escape( __('Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.') ) . '",
+invalid_data:"' . mce_escape( __('Error: Invalid values entered, these are marked in red.') ) . '",
+more_colors:"' . mce_escape( __('More colors') ) . '"
+},
+contextmenu:{
+align:"' . mce_escape( __('Alignment') ) . '",
+left:"' . mce_escape( __('Left') ) . '",
+center:"' . mce_escape( __('Center') ) . '",
+right:"' . mce_escape( __('Right') ) . '",
+full:"' . mce_escape( __('Full') ) . '"
+},
+insertdatetime:{
+date_fmt:"' . mce_escape( __('%Y-%m-%d') ) . '",
+time_fmt:"' . mce_escape( __('%H:%M:%S') ) . '",
+insertdate_desc:"' . mce_escape( __('Insert date') ) . '",
+inserttime_desc:"' . mce_escape( __('Insert time') ) . '",
+months_long:"' . mce_escape( _c('January,February,March,April,May,June,July,August,September,October,November,December|Comma separated list of the months. No spaces between them.') ) . '",
+months_short:"' . mce_escape( _c('Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec|Comma separated list of the abbreviated names of the months. No spaces between them.') ) . '",
+day_long:"' . mce_escape( _c('Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday|Comma separated list of the days of the week. No spaces between them.') ) . '",
+day_short:"' . mce_escape( _c('Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun|Comma separated list of the abbreviated names for the days of the week. No spaces between them.') ) . '"
+},
+print:{
+print_desc:"' . mce_escape( __('Print') ) . '"
+},
+preview:{
+preview_desc:"' . mce_escape( __('Preview') ) . '"
+},
+directionality:{
+ltr_desc:"' . mce_escape( __('Direction left to right') ) . '",
+rtl_desc:"' . mce_escape( __('Direction right to left') ) . '"
+},
+layer:{
+insertlayer_desc:"' . mce_escape( __('Insert new layer') ) . '",
+forward_desc:"' . mce_escape( __('Move forward') ) . '",
+backward_desc:"' . mce_escape( __('Move backward') ) . '",
+absolute_desc:"' . mce_escape( __('Toggle absolute positioning') ) . '",
+content:"' . mce_escape( __('New layer...') ) . '"
+},
+save:{
+save_desc:"' . mce_escape( __('Save') ) . '",
+cancel_desc:"' . mce_escape( __('Cancel all changes') ) . '"
+},
+nonbreaking:{
+nonbreaking_desc:"' . mce_escape( __('Insert non-breaking space character') ) . '"
+},
+iespell:{
+iespell_desc:"' . mce_escape( __('Run spell checking') ) . '",
+download:"' . mce_escape( __('ieSpell not detected. Do you want to install it now?') ) . '"
+},
+advhr:{
+advhr_desc:"' . mce_escape( __('Horizontale rule') ) . '"
+},
+emotions:{
+emotions_desc:"' . mce_escape( __('Emotions') ) . '"
+},
+searchreplace:{
+search_desc:"' . mce_escape( __('Find') ) . '",
+replace_desc:"' . mce_escape( __('Find/Replace') ) . '"
+},
+advimage:{
+image_desc:"' . mce_escape( __('Insert/edit image') ) . '"
+},
+advlink:{
+link_desc:"' . mce_escape( __('Insert/edit link') ) . '"
+},
+xhtmlxtras:{
+cite_desc:"' . mce_escape( __('Citation') ) . '",
+abbr_desc:"' . mce_escape( __('Abbreviation') ) . '",
+acronym_desc:"' . mce_escape( __('Acronym') ) . '",
+del_desc:"' . mce_escape( __('Deletion') ) . '",
+ins_desc:"' . mce_escape( __('Insertion') ) . '",
+attribs_desc:"' . mce_escape( __('Insert/Edit Attributes') ) . '"
+},
+style:{
+desc:"' . mce_escape( __('Edit CSS Style') ) . '"
+},
+paste:{
+paste_text_desc:"' . mce_escape( __('Paste as Plain Text') ) . '",
+paste_word_desc:"' . mce_escape( __('Paste from Word') ) . '",
+selectall_desc:"' . mce_escape( __('Select All') ) . '"
+},
+paste_dlg:{
+text_title:"' . mce_escape( __('Use CTRL+V on your keyboard to paste the text into the window.') ) . '",
+text_linebreaks:"' . mce_escape( __('Keep linebreaks') ) . '",
+word_title:"' . mce_escape( __('Use CTRL+V on your keyboard to paste the text into the window.') ) . '"
+},
+table:{
+desc:"' . mce_escape( __('Inserts a new table') ) . '",
+row_before_desc:"' . mce_escape( __('Insert row before') ) . '",
+row_after_desc:"' . mce_escape( __('Insert row after') ) . '",
+delete_row_desc:"' . mce_escape( __('Delete row') ) . '",
+col_before_desc:"' . mce_escape( __('Insert column before') ) . '",
+col_after_desc:"' . mce_escape( __('Insert column after') ) . '",
+delete_col_desc:"' . mce_escape( __('Remove column') ) . '",
+split_cells_desc:"' . mce_escape( __('Split merged table cells') ) . '",
+merge_cells_desc:"' . mce_escape( __('Merge table cells') ) . '",
+row_desc:"' . mce_escape( __('Table row properties') ) . '",
+cell_desc:"' . mce_escape( __('Table cell properties') ) . '",
+props_desc:"' . mce_escape( __('Table properties') ) . '",
+paste_row_before_desc:"' . mce_escape( __('Paste table row before') ) . '",
+paste_row_after_desc:"' . mce_escape( __('Paste table row after') ) . '",
+cut_row_desc:"' . mce_escape( __('Cut table row') ) . '",
+copy_row_desc:"' . mce_escape( __('Copy table row') ) . '",
+del:"' . mce_escape( __('Delete table') ) . '",
+row:"' . mce_escape( __('Row') ) . '",
+col:"' . mce_escape( __('Column') ) . '",
+cell:"' . mce_escape( __('Cell') ) . '"
+},
+autosave:{
+unload_msg:"' . mce_escape( __('The changes you made will be lost if you navigate away from this page.') ) . '"
+},
+fullscreen:{
+desc:"' . mce_escape( __('Toggle fullscreen mode') ) . ' (Alt+Shift+G)"
+},
+media:{
+desc:"' . mce_escape( __('Insert / edit embedded media') ) . '",
+delta_width:"' . mce_escape( _c('0| Extra width for the media popup in pixels') ) . '",
+delta_height:"' . mce_escape( _c('0| Extra height for the media popup in pixels') ) . '",
+edit:"' . mce_escape( __('Edit embedded media') ) . '"
+},
+fullpage:{
+desc:"' . mce_escape( __('Document properties') ) . '"
+},
+template:{
+desc:"' . mce_escape( __('Insert predefined template content') ) . '"
+},
+visualchars:{
+desc:"' . mce_escape( __('Visual control characters on/off.') ) . '"
+},
+spellchecker:{
+desc:"' . mce_escape( __('Toggle spellchecker') ) . ' (Alt+Shift+N)",
+menu:"' . mce_escape( __('Spellchecker settings') ) . '",
+ignore_word:"' . mce_escape( __('Ignore word') ) . '",
+ignore_words:"' . mce_escape( __('Ignore all') ) . '",
+langs:"' . mce_escape( __('Languages') ) . '",
+wait:"' . mce_escape( __('Please wait...') ) . '",
+sug:"' . mce_escape( __('Suggestions') ) . '",
+no_sug:"' . mce_escape( __('No suggestions') ) . '",
+no_mpell:"' . mce_escape( __('No misspellings found.') ) . '"
+},
+pagebreak:{
+desc:"' . mce_escape( __('Insert page break.') ) . '"
+}}});
+
+tinyMCE.addI18n("' . $language . '.advanced",{
+style_select:"' . mce_escape( __('Styles') ) . '",
+font_size:"' . mce_escape( __('Font size') ) . '",
+fontdefault:"' . mce_escape( __('Font family') ) . '",
+block:"' . mce_escape( __('Format') ) . '",
+paragraph:"' . mce_escape( __('Paragraph') ) . '",
+div:"' . mce_escape( __('Div') ) . '",
+address:"' . mce_escape( __('Address') ) . '",
+pre:"' . mce_escape( __('Preformatted') ) . '",
+h1:"' . mce_escape( __('Heading 1') ) . '",
+h2:"' . mce_escape( __('Heading 2') ) . '",
+h3:"' . mce_escape( __('Heading 3') ) . '",
+h4:"' . mce_escape( __('Heading 4') ) . '",
+h5:"' . mce_escape( __('Heading 5') ) . '",
+h6:"' . mce_escape( __('Heading 6') ) . '",
+blockquote:"' . mce_escape( __('Blockquote') ) . '",
+code:"' . mce_escape( __('Code') ) . '",
+samp:"' . mce_escape( __('Code sample') ) . '",
+dt:"' . mce_escape( __('Definition term ') ) . '",
+dd:"' . mce_escape( __('Definition description') ) . '",
+bold_desc:"' . mce_escape( __('Bold') ) . ' (Ctrl / Alt+Shift + B)",
+italic_desc:"' . mce_escape( __('Italic') ) . ' (Ctrl / Alt+Shift + I)",
+underline_desc:"' . mce_escape( __('Underline') ) . '",
+striketrough_desc:"' . mce_escape( __('Strikethrough') ) . ' (Alt+Shift+D)",
+justifyleft_desc:"' . mce_escape( __('Align left') ) . ' (Alt+Shift+L)",
+justifycenter_desc:"' . mce_escape( __('Align center') ) . ' (Alt+Shift+C)",
+justifyright_desc:"' . mce_escape( __('Align right') ) . ' (Alt+Shift+R)",
+justifyfull_desc:"' . mce_escape( __('Align full') ) . ' (Alt+Shift+J)",
+bullist_desc:"' . mce_escape( __('Unordered list') ) . ' (Alt+Shift+U)",
+numlist_desc:"' . mce_escape( __('Ordered list') ) . ' (Alt+Shift+O)",
+outdent_desc:"' . mce_escape( __('Outdent') ) . '",
+indent_desc:"' . mce_escape( __('Indent') ) . '",
+undo_desc:"' . mce_escape( __('Undo') ) . ' (Ctrl+Z)",
+redo_desc:"' . mce_escape( __('Redo') ) . ' (Ctrl+Y)",
+link_desc:"' . mce_escape( __('Insert/edit link') ) . ' (Alt+Shift+A)",
+link_delta_width:"' . mce_escape( _c('0| Extra width for the link popup in pixels') ) . '",
+link_delta_height:"' . mce_escape( _c('0| Extra height for the link popup in pixels') ) . '",
+unlink_desc:"' . mce_escape( __('Unlink') ) . ' (Alt+Shift+S)",
+image_desc:"' . mce_escape( __('Insert/edit image') ) . ' (Alt+Shift+M)",
+image_delta_width:"' . mce_escape( _c('0| Extra width for the image popup in pixels') ) . '",
+image_delta_height:"' . mce_escape( _c('0| Extra height for the image popup in pixels') ) . '",
+cleanup_desc:"' . mce_escape( __('Cleanup messy code') ) . '",
+code_desc:"' . mce_escape( __('Edit HTML Source') ) . '",
+sub_desc:"' . mce_escape( __('Subscript') ) . '",
+sup_desc:"' . mce_escape( __('Superscript') ) . '",
+hr_desc:"' . mce_escape( __('Insert horizontal ruler') ) . '",
+removeformat_desc:"' . mce_escape( __('Remove formatting') ) . '",
+forecolor_desc:"' . mce_escape( __('Select text color') ) . '",
+backcolor_desc:"' . mce_escape( __('Select background color') ) . '",
+charmap_desc:"' . mce_escape( __('Insert custom character') ) . '",
+visualaid_desc:"' . mce_escape( __('Toggle guidelines/invisible elements') ) . '",
+anchor_desc:"' . mce_escape( __('Insert/edit anchor') ) . '",
+cut_desc:"' . mce_escape( __('Cut') ) . '",
+copy_desc:"' . mce_escape( __('Copy') ) . '",
+paste_desc:"' . mce_escape( __('Paste') ) . '",
+image_props_desc:"' . mce_escape( __('Image properties') ) . '",
+newdocument_desc:"' . mce_escape( __('New document') ) . '",
+help_desc:"' . mce_escape( __('Help') ) . '",
+blockquote_desc:"' . mce_escape( __('Blockquote') ) . ' (Alt+Shift+Q)",
+clipboard_msg:"' . mce_escape( __('Copy/Cut/Paste is not available in Mozilla and Firefox.') ) . '",
+path:"' . mce_escape( __('Path') ) . '",
+newdocument:"' . mce_escape( __('Are you sure you want to clear all contents?') ) . '",
+toolbar_focus:"' . mce_escape( __('Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X') ) . '",
+more_colors:"' . mce_escape( __('More colors') ) . '",
+colorpicker_delta_width:"' . mce_escape( _c('0| Extra width for the colorpicker popup in pixels') ) . '",
+colorpicker_delta_height:"' . mce_escape( _c('0| Extra height for the colorpicker popup in pixels') ) . '"
+});
+
+tinyMCE.addI18n("' . $language . '.advanced_dlg",{
+about_title:"' . mce_escape( __('About TinyMCE') ) . '",
+about_general:"' . mce_escape( __('About') ) . '",
+about_help:"' . mce_escape( __('Help') ) . '",
+about_license:"' . mce_escape( __('License') ) . '",
+about_plugins:"' . mce_escape( __('Plugins') ) . '",
+about_plugin:"' . mce_escape( __('Plugin') ) . '",
+about_author:"' . mce_escape( __('Author') ) . '",
+about_version:"' . mce_escape( __('Version') ) . '",
+about_loaded:"' . mce_escape( __('Loaded plugins') ) . '",
+anchor_title:"' . mce_escape( __('Insert/edit anchor') ) . '",
+anchor_name:"' . mce_escape( __('Anchor name') ) . '",
+code_title:"' . mce_escape( __('HTML Source Editor') ) . '",
+code_wordwrap:"' . mce_escape( __('Word wrap') ) . '",
+colorpicker_title:"' . mce_escape( __('Select a color') ) . '",
+colorpicker_picker_tab:"' . mce_escape( __('Picker') ) . '",
+colorpicker_picker_title:"' . mce_escape( __('Color picker') ) . '",
+colorpicker_palette_tab:"' . mce_escape( __('Palette') ) . '",
+colorpicker_palette_title:"' . mce_escape( __('Palette colors') ) . '",
+colorpicker_named_tab:"' . mce_escape( __('Named') ) . '",
+colorpicker_named_title:"' . mce_escape( __('Named colors') ) . '",
+colorpicker_color:"' . mce_escape( __('Color:') ) . '",
+colorpicker_name:"' . mce_escape( __('Name:') ) . '",
+charmap_title:"' . mce_escape( __('Select custom character') ) . '",
+image_title:"' . mce_escape( __('Insert/edit image') ) . '",
+image_src:"' . mce_escape( __('Image URL') ) . '",
+image_alt:"' . mce_escape( __('Image description') ) . '",
+image_list:"' . mce_escape( __('Image list') ) . '",
+image_border:"' . mce_escape( __('Border') ) . '",
+image_dimensions:"' . mce_escape( __('Dimensions') ) . '",
+image_vspace:"' . mce_escape( __('Vertical space') ) . '",
+image_hspace:"' . mce_escape( __('Horizontal space') ) . '",
+image_align:"' . mce_escape( __('Alignment') ) . '",
+image_align_baseline:"' . mce_escape( __('Baseline') ) . '",
+image_align_top:"' . mce_escape( __('Top') ) . '",
+image_align_middle:"' . mce_escape( __('Middle') ) . '",
+image_align_bottom:"' . mce_escape( __('Bottom') ) . '",
+image_align_texttop:"' . mce_escape( __('Text top') ) . '",
+image_align_textbottom:"' . mce_escape( __('Text bottom') ) . '",
+image_align_left:"' . mce_escape( __('Left') ) . '",
+image_align_right:"' . mce_escape( __('Right') ) . '",
+link_title:"' . mce_escape( __('Insert/edit link') ) . '",
+link_url:"' . mce_escape( __('Link URL') ) . '",
+link_target:"' . mce_escape( __('Target') ) . '",
+link_target_same:"' . mce_escape( __('Open link in the same window') ) . '",
+link_target_blank:"' . mce_escape( __('Open link in a new window') ) . '",
+link_titlefield:"' . mce_escape( __('Title') ) . '",
+link_is_email:"' . mce_escape( __('The URL you entered seems to be an email address, do you want to add the required mailto: prefix?') ) . '",
+link_is_external:"' . mce_escape( __('The URL you entered seems to external link, do you want to add the required http:// prefix?') ) . '",
+link_list:"' . mce_escape( __('Link list') ) . '"
+});
+
+tinyMCE.addI18n("' . $language . '.media_dlg",{
+title:"' . mce_escape( __('Insert / edit embedded media') ) . '",
+general:"' . mce_escape( __('General') ) . '",
+advanced:"' . mce_escape( __('Advanced') ) . '",
+file:"' . mce_escape( __('File/URL') ) . '",
+list:"' . mce_escape( __('List') ) . '",
+size:"' . mce_escape( __('Dimensions') ) . '",
+preview:"' . mce_escape( __('Preview') ) . '",
+constrain_proportions:"' . mce_escape( __('Constrain proportions') ) . '",
+type:"' . mce_escape( __('Type') ) . '",
+id:"' . mce_escape( __('Id') ) . '",
+name:"' . mce_escape( __('Name') ) . '",
+class_name:"' . mce_escape( __('Class') ) . '",
+vspace:"' . mce_escape( __('V-Space') ) . '",
+hspace:"' . mce_escape( __('H-Space') ) . '",
+play:"' . mce_escape( __('Auto play') ) . '",
+loop:"' . mce_escape( __('Loop') ) . '",
+menu:"' . mce_escape( __('Show menu') ) . '",
+quality:"' . mce_escape( __('Quality') ) . '",
+scale:"' . mce_escape( __('Scale') ) . '",
+align:"' . mce_escape( __('Align') ) . '",
+salign:"' . mce_escape( __('SAlign') ) . '",
+wmode:"' . mce_escape( __('WMode') ) . '",
+bgcolor:"' . mce_escape( __('Background') ) . '",
+base:"' . mce_escape( __('Base') ) . '",
+flashvars:"' . mce_escape( __('Flashvars') ) . '",
+liveconnect:"' . mce_escape( __('SWLiveConnect') ) . '",
+autohref:"' . mce_escape( __('AutoHREF') ) . '",
+cache:"' . mce_escape( __('Cache') ) . '",
+hidden:"' . mce_escape( __('Hidden') ) . '",
+controller:"' . mce_escape( __('Controller') ) . '",
+kioskmode:"' . mce_escape( __('Kiosk mode') ) . '",
+playeveryframe:"' . mce_escape( __('Play every frame') ) . '",
+targetcache:"' . mce_escape( __('Target cache') ) . '",
+correction:"' . mce_escape( __('No correction') ) . '",
+enablejavascript:"' . mce_escape( __('Enable JavaScript') ) . '",
+starttime:"' . mce_escape( __('Start time') ) . '",
+endtime:"' . mce_escape( __('End time') ) . '",
+href:"' . mce_escape( __('Href') ) . '",
+qtsrcchokespeed:"' . mce_escape( __('Choke speed') ) . '",
+target:"' . mce_escape( __('Target') ) . '",
+volume:"' . mce_escape( __('Volume') ) . '",
+autostart:"' . mce_escape( __('Auto start') ) . '",
+enabled:"' . mce_escape( __('Enabled') ) . '",
+fullscreen:"' . mce_escape( __('Fullscreen') ) . '",
+invokeurls:"' . mce_escape( __('Invoke URLs') ) . '",
+mute:"' . mce_escape( __('Mute') ) . '",
+stretchtofit:"' . mce_escape( __('Stretch to fit') ) . '",
+windowlessvideo:"' . mce_escape( __('Windowless video') ) . '",
+balance:"' . mce_escape( __('Balance') ) . '",
+baseurl:"' . mce_escape( __('Base URL') ) . '",
+captioningid:"' . mce_escape( __('Captioning id') ) . '",
+currentmarker:"' . mce_escape( __('Current marker') ) . '",
+currentposition:"' . mce_escape( __('Current position') ) . '",
+defaultframe:"' . mce_escape( __('Default frame') ) . '",
+playcount:"' . mce_escape( __('Play count') ) . '",
+rate:"' . mce_escape( __('Rate') ) . '",
+uimode:"' . mce_escape( __('UI Mode') ) . '",
+flash_options:"' . mce_escape( __('Flash options') ) . '",
+qt_options:"' . mce_escape( __('Quicktime options') ) . '",
+wmp_options:"' . mce_escape( __('Windows media player options') ) . '",
+rmp_options:"' . mce_escape( __('Real media player options') ) . '",
+shockwave_options:"' . mce_escape( __('Shockwave options') ) . '",
+autogotourl:"' . mce_escape( __('Auto goto URL') ) . '",
+center:"' . mce_escape( __('Center') ) . '",
+imagestatus:"' . mce_escape( __('Image status') ) . '",
+maintainaspect:"' . mce_escape( __('Maintain aspect') ) . '",
+nojava:"' . mce_escape( __('No java') ) . '",
+prefetch:"' . mce_escape( __('Prefetch') ) . '",
+shuffle:"' . mce_escape( __('Shuffle') ) . '",
+console:"' . mce_escape( __('Console') ) . '",
+numloop:"' . mce_escape( __('Num loops') ) . '",
+controls:"' . mce_escape( __('Controls') ) . '",
+scriptcallbacks:"' . mce_escape( __('Script callbacks') ) . '",
+swstretchstyle:"' . mce_escape( __('Stretch style') ) . '",
+swstretchhalign:"' . mce_escape( __('Stretch H-Align') ) . '",
+swstretchvalign:"' . mce_escape( __('Stretch V-Align') ) . '",
+sound:"' . mce_escape( __('Sound') ) . '",
+progress:"' . mce_escape( __('Progress') ) . '",
+qtsrc:"' . mce_escape( __('QT Src') ) . '",
+qt_stream_warn:"' . mce_escape( __('Streamed rtsp resources should be added to the QT Src field under the advanced tab.') ) . '",
+align_top:"' . mce_escape( __('Top') ) . '",
+align_right:"' . mce_escape( __('Right') ) . '",
+align_bottom:"' . mce_escape( __('Bottom') ) . '",
+align_left:"' . mce_escape( __('Left') ) . '",
+align_center:"' . mce_escape( __('Center') ) . '",
+align_top_left:"' . mce_escape( __('Top left') ) . '",
+align_top_right:"' . mce_escape( __('Top right') ) . '",
+align_bottom_left:"' . mce_escape( __('Bottom left') ) . '",
+align_bottom_right:"' . mce_escape( __('Bottom right') ) . '",
+flv_options:"' . mce_escape( __('Flash video options') ) . '",
+flv_scalemode:"' . mce_escape( __('Scale mode') ) . '",
+flv_buffer:"' . mce_escape( __('Buffer') ) . '",
+flv_startimage:"' . mce_escape( __('Start image') ) . '",
+flv_starttime:"' . mce_escape( __('Start time') ) . '",
+flv_defaultvolume:"' . mce_escape( __('Default volume') ) . '",
+flv_hiddengui:"' . mce_escape( __('Hidden GUI') ) . '",
+flv_autostart:"' . mce_escape( __('Auto start') ) . '",
+flv_loop:"' . mce_escape( __('Loop') ) . '",
+flv_showscalemodes:"' . mce_escape( __('Show scale modes') ) . '",
+flv_smoothvideo:"' . mce_escape( __('Smooth video') ) . '",
+flv_jscallback:"' . mce_escape( __('JS Callback') ) . '"
+});
+
+tinyMCE.addI18n("' . $language . '.wordpress",{
+wp_adv_desc:"' . mce_escape( __('Show/Hide Kitchen Sink') ) . ' (Alt+Shift+Z)",
+wp_more_desc:"' . mce_escape( __('Insert More tag') ) . ' (Alt+Shift+T)",
+wp_page_desc:"' . mce_escape( __('Insert Page break') ) . ' (Alt+Shift+P)",
+wp_help_desc:"' . mce_escape( __('Help') ) . ' (Alt+Shift+H)",
+wp_more_alt:"' . mce_escape( __('More...') ) . '",
+wp_page_alt:"' . mce_escape( __('Next page...') ) . '"
+});
+'; ?>
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
deleted file mode 100644
index 102d69b..0000000
--- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
-
-function TinyMCE_autosave_getInfo() {
- return {
- longname : 'Auto save',
- author : 'Moxiecode Systems',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
-};
-
-function TinyMCE_autosave_beforeUnloadHandler() {
- var msg = tinyMCE.getLang("lang_autosave_unload_msg");
-
- var anyDirty = false;
- for (var n in tinyMCE.instances) {
- var inst = tinyMCE.instances[n];
- if (!tinyMCE.isInstance(inst))
- continue;
-
- if (inst.isDirty())
- return msg;
- }
-
- return;
-}
-
-window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
diff --git a/wp-includes/js/tinymce/plugins/autosave/langs/en.js b/wp-includes/js/tinymce/plugins/autosave/langs/en.js
deleted file mode 100644
index 0195133..0000000
--- a/wp-includes/js/tinymce/plugins/autosave/langs/en.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// EN lang variables
-
-tinyMCE.addToLang('',{
-autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
-});
diff --git a/wp-includes/js/tinymce/plugins/directionality/images/ltr.gif b/wp-includes/js/tinymce/plugins/directionality/images/ltr.gif
deleted file mode 100644
index ac8f30c..0000000
--- a/wp-includes/js/tinymce/plugins/directionality/images/ltr.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/directionality/images/rtl.gif b/wp-includes/js/tinymce/plugins/directionality/images/rtl.gif
deleted file mode 100644
index 0348f99..0000000
--- a/wp-includes/js/tinymce/plugins/directionality/images/rtl.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/directionality/langs/en.js b/wp-includes/js/tinymce/plugins/directionality/langs/en.js
deleted file mode 100644
index 5b392fe..0000000
--- a/wp-includes/js/tinymce/plugins/directionality/langs/en.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-directionality_ltr_desc : 'Direction left to right (Alt-.)',
-directionality_rtl_desc : 'Direction right to left (Alt-,)'
-});
diff --git a/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js b/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js
new file mode 100644
index 0000000..6a21ea7
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js
@@ -0,0 +1 @@
+(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=document.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{window.setTimeout(function(){tinymce.dom.Event.remove(window,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(document.body,'overflow',ed.getParam('fullscreen_overflow'));window.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=window.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(document.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(document.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();window.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(document.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:150;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(window,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm b/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm
new file mode 100644
index 0000000..c79ecd0
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm
@@ -0,0 +1,111 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <script type="text/javascript" src="../../tiny_mce.js"></script>
+ <script type="text/javascript">
+ function patchCallback(settings, key) {
+ if (settings[key])
+ settings[key] = "window.opener." + settings[key];
+ }
+
+ var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings;
+
+ // Clone array
+ for (var n in paSe)
+ settings[n] = paSe[n];
+
+ // Override options for fullscreen
+ for (var n in paSe.fullscreen_settings)
+ settings[n] = paSe.fullscreen_settings[n];
+
+ // Patch callbacks, make them point to window.opener
+ patchCallback(settings, 'urlconverter_callback');
+ patchCallback(settings, 'insertlink_callback');
+ patchCallback(settings, 'insertimage_callback');
+ patchCallback(settings, 'setupcontent_callback');
+ patchCallback(settings, 'save_callback');
+ patchCallback(settings, 'onchange_callback');
+ patchCallback(settings, 'init_instance_callback');
+ patchCallback(settings, 'file_browser_callback');
+ patchCallback(settings, 'cleanup_callback');
+ patchCallback(settings, 'execcommand_callback');
+ patchCallback(settings, 'oninit');
+
+ // Set options
+ delete settings.id;
+ settings['mode'] = 'exact';
+ settings['elements'] = 'fullscreenarea';
+ settings['add_unload_trigger'] = false;
+ settings['ask'] = false;
+ settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
+ settings['fullscreen_is_enabled'] = true;
+ settings['fullscreen_editor_id'] = window.opener.tinyMCE.activeEditor.id;
+ settings['theme_advanced_resizing'] = false;
+ settings['strict_loading_mode'] = true;
+
+ settings.save_onsavecallback = function() {
+ window.opener.tinyMCE.activeEditor.setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
+ window.opener.tinyMCE.activeEditor.execCommand('mceSave');
+ window.close();
+ };
+
+ function unloadHandler(e) {
+ moveContent();
+ }
+
+ function moveContent() {
+ window.opener.tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent());
+ }
+
+ function closeFullscreen() {
+ moveContent();
+ window.close();
+ }
+
+ function doParentSubmit() {
+ moveContent();
+
+ if (window.opener.tinyMCE.selectedInstance.formElement.form)
+ window.opener.tinyMCE.selectedInstance.formElement.form.submit();
+
+ window.close();
+
+ return false;
+ }
+
+ function render() {
+ var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
+
+ e.value = window.opener.tinyMCE.activeEditor.getContent();
+
+ vp = dom.getViewPort();
+ settings.width = vp.w;
+ settings.height = vp.h - 15;
+
+ tinymce.dom.Event.add(window, 'resize', function() {
+ var vp = dom.getViewPort();
+
+ tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
+ });
+
+ tinyMCE.init(settings);
+ }
+
+ // Add onunload
+ tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
+ </script>
+ <base target="_self" />
+</head>
+<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
+<form onsubmit="doParentSubmit();">
+<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
+</form>
+
+<script type="text/javascript">
+ render();
+</script>
+
+</body>
+</html>
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css b/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css
deleted file mode 100644
index 43be823..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Window classes */
-
-.mceWindow {
- position: absolute;
- left: 0;
- top: 0;
- border: 1px solid black;
- background-color: #D4D0C8;
-}
-
-.mceWindowHead {
- background-color: #334F8D;
- width: 100%;
- height: 18px;
- cursor: move;
- overflow: hidden;
-}
-
-.mceWindowBody {
- clear: both;
- background-color: white;
-}
-
-.mceWindowStatusbar {
- background-color: #D4D0C8;
- height: 12px;
- border-top: 1px solid black;
-}
-
-.mceWindowTitle {
- float: left;
- font-family: "MS Sans Serif";
- font-size: 9pt;
- font-weight: bold;
- line-height: 18px;
- color: white;
- margin-left: 2px;
- overflow: hidden;
-}
-
-.mceWindowHeadTools {
- margin-right: 2px;
-}
-
-.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize {
- display: block;
- float: right;
- overflow: hidden;
- margin-top: 2px;
-}
-
-.mceWindowClose {
- margin-left: 2px;
-}
-
-.mceWindowMinimize {
-}
-
-.mceWindowMaximize {
-}
-
-.mceWindowResize {
- display: block;
- float: right;
- overflow: hidden;
- cursor: se-resize;
- width: 12px;
- height: 12px;
-}
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif
deleted file mode 100644
index fc25609..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif
deleted file mode 100644
index 3469e5a..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif
deleted file mode 100644
index fcae73e..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif
deleted file mode 100644
index 94f167a..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif
deleted file mode 100644
index 6c402d0..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
deleted file mode 100644
index 325d293..0000000
--- a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
+++ /dev/null
@@ -1,453 +0,0 @@
-/**
- * $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
- *
- * Moxiecode DHTML Windows script.
- *
- * @author Moxiecode
- * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
- */
-
-// Windows handler
-function MCWindows() {
- this.settings = new Array();
- this.windows = new Array();
- this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
- this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
- this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
- this.isMac = navigator.userAgent.indexOf('Mac') != -1;
- this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
- this.action = "none";
- this.selectedWindow = null;
- this.zindex = 100;
- this.mouseDownScreenX = 0;
- this.mouseDownScreenY = 0;
- this.mouseDownLayerX = 0;
- this.mouseDownLayerY = 0;
- this.mouseDownWidth = 0;
- this.mouseDownHeight = 0;
-};
-
-MCWindows.prototype.init = function(settings) {
- this.settings = settings;
-
- if (this.isMSIE)
- this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
- else
- this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
-
- this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
-};
-
-MCWindows.prototype.getParam = function(name, default_value) {
- var value = null;
-
- value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
-
- // Fix bool values
- if (value == "true" || value == "false")
- return (value == "true");
-
- return value;
-};
-
-MCWindows.prototype.eventDispatcher = function(e) {
- e = typeof(e) == "undefined" ? window.event : e;
-
- if (mcWindows.selectedWindow == null)
- return;
-
- // Switch focus
- if (mcWindows.isGecko && e.type == "mousedown") {
- var elm = e.currentTarget;
-
- for (var n in mcWindows.windows) {
- var win = mcWindows.windows[n];
- if (typeof(win) == 'function')
- continue;
-
- if (win.headElement == elm || win.resizeElement == elm) {
- win.focus();
- break;
- }
- }
- }
-
- switch (e.type) {
- case "mousemove":
- mcWindows.selectedWindow.onMouseMove(e);
- break;
-
- case "mouseup":
- mcWindows.selectedWindow.onMouseUp(e);
- break;
-
- case "mousedown":
- mcWindows.selectedWindow.onMouseDown(e);
- break;
-
- case "focus":
- mcWindows.selectedWindow.onFocus(e);
- break;
- }
-}
-
-MCWindows.prototype.addEvent = function(obj, name, handler) {
- if (this.isMSIE)
- obj.attachEvent("on" + name, handler);
- else
- obj.addEventListener(name, handler, true);
-};
-
-MCWindows.prototype.cancelEvent = function(e) {
- if (this.isMSIE) {
- e.returnValue = false;
- e.cancelBubble = true;
- } else
- e.preventDefault();
-};
-
-MCWindows.prototype.parseFeatures = function(opts) {
- // Cleanup the options
- opts = opts.toLowerCase();
- opts = opts.replace(/;/g, ",");
- opts = opts.replace(/[^0-9a-z=,]/g, "");
-
- var optionChunks = opts.split(',');
- var options = new Array();
-
- options['left'] = 10;
- options['top'] = 10;
- options['width'] = 300;
- options['height'] = 300;
- options['resizable'] = true;
- options['minimizable'] = true;
- options['maximizable'] = true;
- options['close'] = true;
- options['movable'] = true;
-
- if (opts == "")
- return options;
-
- for (var i=0; i<optionChunks.length; i++) {
- var parts = optionChunks[i].split('=');
-
- if (parts.length == 2)
- options[parts[0]] = parts[1];
- }
-
- return options;
-};
-
-MCWindows.prototype.open = function(url, name, features) {
- var win = new MCWindow();
- var winDiv, html = "", id;
-
- features = this.parseFeatures(features);
-
- // Create div
- id = "mcWindow_" + name;
-
- width = parseInt(features['width']);
- height = parseInt(features['height'])-12-19;
-
- if (this.isMSIE)
- width -= 2;
-
- // Setup first part of window
- win.id = id;
- win.url = url;
- win.name = name;
- win.features = features;
- this.windows[name] = win;
-
- iframeWidth = width;
- iframeHeight = height;
-
- // Create inner content
- html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
- html += '<html>';
- html += '<head>';
- html += '<title>Wrapper iframe</title>';
- html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
- html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
- html += '</head>';
- html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
-
- html += '<div id="' + id + '_container" class="mceWindow">';
- html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
- html += ' <div id="' + id + '_title" class="mceWindowTitle"';
- html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
- html += ' <div class="mceWindowHeadTools">';
- html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
-// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
-// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
- html += ' </div>';
- html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
- html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
- html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
- html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
- html += '</div>';
- html += '</div>';
-
- html += '</body>';
- html += '</html>';
-
- // Create iframe
- this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
-};
-
-// Gets called when wrapper iframe is initialized
-MCWindows.prototype.onLoad = function(name) {
- var win = mcWindows.windows[name];
- var id = "mcWindow_" + name;
- var wrapperIframe = window.frames[id + "_iframe"].frames[0];
- var wrapperDoc = window.frames[id + "_iframe"].document;
- var doc = window.frames[id + "_iframe"].document;
- var winDiv = document.getElementById("mcWindow_" + name + "_div");
- var realIframe = window.frames[id + "_iframe"].frames[0];
-
- // Set window data
- win.id = "mcWindow_" + name + "_iframe";
- win.winElement = winDiv;
- win.bodyElement = doc.getElementById(id + '_body');
- win.iframeElement = doc.getElementById(id + '_iframe');
- win.headElement = doc.getElementById(id + '_head');
- win.titleElement = doc.getElementById(id + '_title');
- win.resizeElement = doc.getElementById(id + '_resize');
- win.containerElement = doc.getElementById(id + '_container');
- win.left = win.features['left'];
- win.top = win.features['top'];
- win.frame = window.frames[id + '_iframe'].frames[0];
- win.wrapperFrame = window.frames[id + '_iframe'];
- win.wrapperIFrameElement = document.getElementById(id + "_iframe");
-
- // Add event handlers
- mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
- mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
-
- if (mcWindows.isMSIE) {
- mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
- mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
- } else {
- mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
- mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
- mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
- }
-
- for (var i=0; i<window.frames.length; i++) {
- if (!window.frames[i]._hasMouseHandlers) {
- if (mcWindows.isMSIE) {
- mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
- mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
- } else {
- mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
- mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
- }
-
- window.frames[i]._hasMouseHandlers = true;
- }
- }
-
- if (mcWindows.isMSIE) {
- mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
- mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
- } else {
- mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
- mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
- mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
- }
-
- this.selectedWindow = win;
-};
-
-MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
- var iframe = document.createElement("iframe");
- var div = document.createElement("div");
-
- width = parseInt(width);
- height = parseInt(height)+1;
-
- // Create wrapper div
- div.setAttribute("id", id_prefix + "_div");
- div.setAttribute("width", width);
- div.setAttribute("height", (height));
- div.style.position = "absolute";
- div.style.left = left + "px";
- div.style.top = top + "px";
- div.style.width = width + "px";
- div.style.height = (height) + "px";
- div.style.backgroundColor = "white";
- div.style.display = "none";
-
- if (this.isGecko) {
- iframeWidth = width + 2;
- iframeHeight = height + 2;
- } else {
- iframeWidth = width;
- iframeHeight = height + 1;
- }
-
- // Create iframe
- iframe.setAttribute("id", id_prefix + "_iframe");
- iframe.setAttribute("name", id_prefix + "_iframe");
- iframe.setAttribute("border", "0");
- iframe.setAttribute("frameBorder", "0");
- iframe.setAttribute("marginWidth", "0");
- iframe.setAttribute("marginHeight", "0");
- iframe.setAttribute("leftMargin", "0");
- iframe.setAttribute("topMargin", "0");
- iframe.setAttribute("width", iframeWidth);
- iframe.setAttribute("height", iframeHeight);
-// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
- // iframe.setAttribute("allowtransparency", "false");
- iframe.setAttribute("scrolling", "no");
- iframe.style.width = iframeWidth + "px";
- iframe.style.height = iframeHeight + "px";
- iframe.style.backgroundColor = "white";
- div.appendChild(iframe);
-
- document.body.appendChild(div);
-
- // Fixed MSIE 5.0 issue
- div.innerHTML = div.innerHTML;
-
- if (this.isSafari) {
- // Give Safari some time to setup
- window.setTimeout(function() {
- doc = window.frames[id_prefix + '_iframe'].document;
- doc.open();
- doc.write(html);
- doc.close();
- }, 10);
- } else {
- doc = window.frames[id_prefix + '_iframe'].window.document
- doc.open();
- doc.write(html);
- doc.close();
- }
-
- div.style.display = "block";
-
- return div;
-};
-
-// Window instance
-function MCWindow() {
-};
-
-MCWindow.prototype.focus = function() {
- this.winElement.style.zIndex = mcWindows.zindex++;
- mcWindows.selectedWindow = this;
-};
-
-MCWindow.prototype.minimize = function() {
-};
-
-MCWindow.prototype.maximize = function() {
-
-};
-
-MCWindow.prototype.startResize = function() {
- mcWindows.action = "resize";
-};
-
-MCWindow.prototype.startMove = function(e) {
- mcWindows.action = "move";
-};
-
-MCWindow.prototype.close = function() {
- document.body.removeChild(this.winElement);
- mcWindows.windows[this.name] = null;
-};
-
-MCWindow.prototype.onMouseMove = function(e) {
- var scrollX = 0;//this.doc.body.scrollLeft;
- var scrollY = 0;//this.doc.body.scrollTop;
-
- // Calculate real X, Y
- var dx = e.screenX - mcWindows.mouseDownScreenX;
- var dy = e.screenY - mcWindows.mouseDownScreenY;
-
- switch (mcWindows.action) {
- case "resize":
- width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
- height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
-
- width = width < 100 ? 100 : width;
- height = height < 100 ? 100 : height;
-
- this.wrapperIFrameElement.style.width = width+2;
- this.wrapperIFrameElement.style.height = height+2;
- this.wrapperIFrameElement.width = width+2;
- this.wrapperIFrameElement.height = height+2;
- this.winElement.style.width = width;
- this.winElement.style.height = height;
-
- height = height-12-19;
-
- this.containerElement.style.width = width;
-
- this.iframeElement.style.width = width;
- this.iframeElement.style.height = height;
- this.bodyElement.style.width = width;
- this.bodyElement.style.height = height;
- this.headElement.style.width = width;
- //this.statusElement.style.width = width;
-
- mcWindows.cancelEvent(e);
- break;
-
- case "move":
- this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
- this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
- this.winElement.style.left = this.left + "px";
- this.winElement.style.top = this.top + "px";
-
- mcWindows.cancelEvent(e);
- break;
- }
-};
-
-MCWindow.prototype.onMouseUp = function(e) {
- mcWindows.action = "none";
-};
-
-MCWindow.prototype.onFocus = function(e) {
- // Gecko only handler
- var winRef = e.currentTarget;
-
- for (var n in mcWindows.windows) {
- var win = mcWindows.windows[n];
- if (typeof(win) == 'function')
- continue;
-
- if (winRef.name == win.id) {
- win.focus();
- return;
- }
- }
-};
-
-MCWindow.prototype.onMouseDown = function(e) {
- var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
-
- var scrollX = 0;//this.doc.body.scrollLeft;
- var scrollY = 0;//this.doc.body.scrollTop;
-
- mcWindows.mouseDownScreenX = e.screenX;
- mcWindows.mouseDownScreenY = e.screenY;
- mcWindows.mouseDownLayerX = this.left;
- mcWindows.mouseDownLayerY = this.top;
- mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
- mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
-
- if (elm == this.resizeElement.firstChild)
- this.startResize(e);
- else
- this.startMove(e);
-
- mcWindows.cancelEvent(e);
-};
-
-// Global instance
-var mcWindows = new MCWindows();
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif
new file mode 100644
index 0000000..94abd08
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif
new file mode 100644
index 0000000..e671094
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif
new file mode 100644
index 0000000..b408ae1
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif
new file mode 100644
index 0000000..497307a
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif
new file mode 100644
index 0000000..c894b2e
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif
new file mode 100644
index 0000000..bf0a03e
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif
new file mode 100644
index 0000000..c2a2ad4
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif
new file mode 100644
index 0000000..43a735f
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css
new file mode 100644
index 0000000..569ca80
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css
@@ -0,0 +1,125 @@
+/* Clearlooks 2 */
+/* Reset */
+.clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
+
+/* General */
+.clearlooks2 div, .clearlooks2 span, .clearlooks2 a {position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
+.clearlooks2 {position:absolute;}
+.clearlooks2 .mceWrapper {position:static}
+.mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%;}
+.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50);}
+
+/* Top */
+.clearlooks2 .mceTop,
+.clearlooks2 .mceTop div {
+ top:0;
+ width:100%;
+ height:23px
+}
+.clearlooks2 .mceTop .mceLeft {
+ width:55%;
+ background-image: none;
+ border-style: solid none none solid;
+ border-width: 1px;
+}
+.clearlooks2 .mceTop .mceCenter {
+}
+.clearlooks2 .mceTop .mceRight {
+ right:0;
+ width:55%;
+ height:23px;
+ background-image: none;
+ border-style: solid solid none none;
+ border-width: 1px;
+}
+.clearlooks2 .mceTop span {
+ width:100%;
+ font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
+ text-align:center;
+ vertical-align:middle;
+ line-height:23px;
+ font-weight:bold;
+}
+.clearlooks2 .mceFocus .mceTop .mceLeft {
+ background-image: none;
+ border-style: solid none none solid;
+ border-width: 1px;
+}
+.clearlooks2 .mceFocus .mceTop .mceCenter {
+}
+.clearlooks2 .mceFocus .mceTop .mceRight {
+ background-image: none;
+ border-style: solid solid none none;
+ border-width: 1px;
+}
+.clearlooks2 .mceFocus .mceTop span {
+color:#FFF
+}
+
+/* Middle */
+.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0;}
+.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto);}
+.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#eaf3fa;border-left:1px solid #c6d9e9;}
+.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF;}
+.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#eaf3fa;border-right:1px solid #c6d9e9;}
+
+/* Bottom */
+.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px;}
+.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#eaf3fa;border-bottom:1px solid #c6d9e9;}
+.clearlooks2 .mceBottom div {top:0;}
+.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#eaf3fa ;border-left:1px solid #c6d9e9;}
+.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%;}
+.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#eaf3fa url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9;}
+.clearlooks2 .mceBottom span {display:none;}
+.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px;}
+.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0;}
+.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px;}
+.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0;}
+.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px;}
+
+/* Actions */
+.clearlooks2 a {width:29px; height:16px; top:3px;}
+.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0;}
+.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0;}
+.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0;}
+.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0;}
+.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px;}
+.clearlooks2 .mceMovable .mceMove {display:block;}
+.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px;}
+.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px;}
+.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px;}
+.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px;}
+.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px;}
+.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px;}
+.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px;}
+.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px;}
+.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px;}
+
+/* Resize */
+.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px;}
+.clearlooks2 .mceResizable .mceResize {display:block;}
+.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none;}
+.clearlooks2 .mceMinimizable .mceMin {display:block;}
+.clearlooks2 .mceMaximizable .mceMax {display:block;}
+.clearlooks2 .mceMaximized .mceMed {display:block;}
+.clearlooks2 .mceMaximized .mceMax {display:none;}
+.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize;}
+.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize;}
+.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize}
+.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;}
+.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize;}
+.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
+.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize;}
+.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize;}
+
+/* Alert/Confirm */
+.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0;}
+.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px;}
+.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal;}
+.clearlooks2 a:hover {font-weight:bold;}
+.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#eaf3fa;}
+.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px;}
+.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif);}
+.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px;}
+.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto;}
+.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif);}
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/template.htm b/wp-includes/js/tinymce/plugins/inlinepopups/template.htm
new file mode 100644
index 0000000..c98fe41
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/template.htm
@@ -0,0 +1,387 @@
+<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Template for dialogs</title>
+<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css" />
+</head>
+<body>
+
+<div class="mceEditor">
+ <div class="clearlooks2" style="width:400px; height:100px; left:10px;">
+ <div class="mceWrapper">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Blured</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:420px;">
+ <div class="mceWrapper mceMovable mceFocus">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Focused</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:120px;">
+ <div class="mceWrapper mceMovable mceFocus mceStatusbar">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:120px;">
+ <div class="mceWrapper mceMovable mceFocus mceStatusbar mceResizable">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar, Resizable</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:230px;">
+ <div class="mceWrapper mceMovable mceFocus mceResizable mceMaximizable">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Resizable, Maximizable</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:230px;">
+ <div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximizable">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Blurred, Maximizable, Statusbar, Resizable</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:10px; top:340px;">
+ <div class="mceWrapper mceMovable mceFocus mceResizable mceMaximized mceMinimizable mceMaximizable">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Maximized, Maximizable, Minimizable</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:100px; left:420px; top:340px;">
+ <div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximized mceMinimizable mceMaximizable">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Blured</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>Content</span>
+ <div class="mceRight"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Statusbar text.</span>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceMin" href="#"></a>
+ <a class="mceMax" href="#"></a>
+ <a class="mceMed" href="#"></a>
+ <a class="mceClose" href="#"></a>
+ <a class="mceResize mceResizeN" href="#"></a>
+ <a class="mceResize mceResizeS" href="#"></a>
+ <a class="mceResize mceResizeW" href="#"></a>
+ <a class="mceResize mceResizeE" href="#"></a>
+ <a class="mceResize mceResizeNW" href="#"></a>
+ <a class="mceResize mceResizeNE" href="#"></a>
+ <a class="mceResize mceResizeSW" href="#"></a>
+ <a class="mceResize mceResizeSE" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:130px; left:10px; top:450px;">
+ <div class="mceWrapper mceMovable mceFocus mceModal mceAlert">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Alert</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ </span>
+ <div class="mceRight"></div>
+ <div class="mceIcon"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceButton mceOk" href="#">Ok</a>
+ <a class="mceClose" href="#"></a>
+ </div>
+ </div>
+
+ <div class="clearlooks2" style="width:400px; height:130px; left:420px; top:450px;">
+ <div class="mceWrapper mceMovable mceFocus mceModal mceConfirm">
+ <div class="mceTop">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ <span>Confirm</span>
+ </div>
+
+ <div class="mceMiddle">
+ <div class="mceLeft"></div>
+ <span>
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ This is a very long error message. This is a very long error message.
+ </span>
+ <div class="mceRight"></div>
+ <div class="mceIcon"></div>
+ </div>
+
+ <div class="mceBottom">
+ <div class="mceLeft"></div>
+ <div class="mceCenter"></div>
+ <div class="mceRight"></div>
+ </div>
+
+ <a class="mceMove" href="#"></a>
+ <a class="mceButton mceOk" href="#">Ok</a>
+ <a class="mceButton mceCancel" href="#">Cancel</a>
+ <a class="mceClose" href="#"></a>
+ </div>
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/wp-includes/js/tinymce/plugins/media/css/content.css b/wp-includes/js/tinymce/plugins/media/css/content.css
new file mode 100644
index 0000000..7739381
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/css/content.css
@@ -0,0 +1,6 @@
+.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;}
+.mceItemShockWave {background-image: url(../img/shockwave.gif);}
+.mceItemFlash {background-image:url(../img/flash.gif);}
+.mceItemQuickTime {background-image:url(../img/quicktime.gif);}
+.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);}
+.mceItemRealMedia {background-image:url(../img/realmedia.gif);}
diff --git a/wp-includes/js/tinymce/plugins/media/css/media.css b/wp-includes/js/tinymce/plugins/media/css/media.css
new file mode 100644
index 0000000..62d666a
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/css/media.css
@@ -0,0 +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;
+}
diff --git a/wp-includes/js/tinymce/plugins/media/editor_plugin.js b/wp-includes/js/tinymce/plugins/media/editor_plugin.js
new file mode 100644
index 0000000..948db7c
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/editor_plugin.js
@@ -0,0 +1 @@
+(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'</span>');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/gi,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){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=ed.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;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},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};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k))dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/media/img/flash.gif b/wp-includes/js/tinymce/plugins/media/img/flash.gif
new file mode 100644
index 0000000..cb192e6
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/img/flash.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/media/img/flv_player.swf b/wp-includes/js/tinymce/plugins/media/img/flv_player.swf
new file mode 100644
index 0000000..042c2ab
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/img/flv_player.swf
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/media/img/quicktime.gif b/wp-includes/js/tinymce/plugins/media/img/quicktime.gif
new file mode 100644
index 0000000..3b04991
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/img/quicktime.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/media/img/realmedia.gif b/wp-includes/js/tinymce/plugins/media/img/realmedia.gif
new file mode 100644
index 0000000..fdfe0b9
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/img/realmedia.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/media/img/shockwave.gif b/wp-includes/js/tinymce/plugins/media/img/shockwave.gif
new file mode 100644
index 0000000..5f235df
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/img/shockwave.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/spacer.gif b/wp-includes/js/tinymce/plugins/media/img/trans.gif
index 3884865..3884865 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/spacer.gif
+++ b/wp-includes/js/tinymce/plugins/media/img/trans.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif b/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif
new file mode 100644
index 0000000..ab50f2d
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/media/js/embed.js b/wp-includes/js/tinymce/plugins/media/js/embed.js
new file mode 100644
index 0000000..6fe25de
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/js/embed.js
@@ -0,0 +1,73 @@
+/**
+ * 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 += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
+ h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
+ h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
+ h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
+ h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
+ h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
+ h += '>';
+
+ for (n in p)
+ h += '<param name="' + n + '" value="' + p[n] + '">';
+
+ h += '<embed type="' + mt + '"';
+
+ for (n in p)
+ h += n + '="' + p[n] + '" ';
+
+ h += '></embed></object>';
+
+ document.write(h);
+}
diff --git a/wp-includes/js/tinymce/plugins/media/js/media.js b/wp-includes/js/tinymce/plugins/media/js/media.js
new file mode 100644
index 0000000..58d2faf
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/js/media.js
@@ -0,0 +1,621 @@
+tinyMCEPopup.requireLangPack();
+
+var oldWidth, oldHeight, ed, url;
+
+if (url = tinyMCEPopup.getParam("media_external_list_url"))
+ document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+
+function init() {
+ var pl = "", f, val;
+ var type = "flash", fe, i;
+
+ ed = tinyMCEPopup.editor;
+
+ tinyMCEPopup.resizeToInnerSize();
+ f = document.forms[0]
+
+ fe = ed.selection.getNode();
+ if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
+ pl = fe.title;
+
+ switch (ed.dom.getAttrib(fe, 'class')) {
+ case 'mceItemFlash':
+ type = 'flash';
+ break;
+
+ case 'mceItemFlashVideo':
+ type = 'flv';
+ 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 = ed.getLang('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('medialist','src','media','media');
+ if (html == "")
+ document.getElementById("linklistrow").style.display = 'none';
+ else
+ document.getElementById("linklistcontainer").innerHTML = html;
+
+ // Resize some elements
+ if (isVisible('filebrowser'))
+ document.getElementById('src').style.width = '230px';
+
+ // Setup form
+ if (pl != "") {
+ pl = tinyMCEPopup.editor.plugins.media._parse(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 = ed.dom.getAttrib(fe, "width")) != "")
+ pl.width = f.width.value = val;
+
+ if ((val = ed.dom.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;
+
+ tinyMCEPopup.restoreSelection();
+
+ if (!AutoValidator.validate(f)) {
+ alert(ed.getLang('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 = ed.selection.getNode();
+ if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ fe.className = "mceItemFlash";
+ break;
+
+ case "flv":
+ fe.className = "mceItemFlashVideo";
+ 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)
+ ed.execCommand('mceRepaint');
+
+ 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 = '<img src="' + tinyMCEPopup.getWindowArg("plugin_url") + '/img/trans.gif"' ;
+
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ h += ' class="mceItemFlash"';
+ break;
+
+ case "flv":
+ h += ' class="mceItemFlashVideo"';
+ break;
+
+ case "shockwave":
+ h += ' class="mceItemShockWave"';
+ break;
+
+ case "qt":
+ h += ' class="mceItemQuickTime"';
+ break;
+
+ case "wmp":
+ h += ' class="mceItemWindowsMedia"';
+ break;
+
+ case "rmp":
+ h += ' class="mceItemRealMedia"';
+ break;
+ }
+
+ h += ' title="' + serializeParameters() + '"';
+ h += ' width="' + f.width.value + '"';
+ h += ' height="' + f.height.value + '"';
+ h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';
+
+ h += ' />';
+
+ ed.execCommand('mceInsertContent', false, h);
+ }
+
+ tinyMCEPopup.close();
+}
+
+function updatePreview() {
+ var f = document.forms[0], type;
+
+ f.width.value = f.width.value || '320';
+ f.height.value = f.height.value || '240';
+
+ type = getType(f.src.value);
+ selectByValue(f, 'media_type', type);
+ changedType(type);
+ generatePreview();
+}
+
+function getMediaListHTML() {
+ if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
+ var html = "";
+
+ html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">';
+ html += '<option value="">---</option>';
+
+ for (var i=0; i<tinyMCEMediaList.length; i++)
+ html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
+
+ html += '</select>';
+
+ return html;
+ }
+
+ return "";
+}
+
+function getType(v) {
+ var fo, i, c, el, x, f = document.forms[0];
+
+ fo = ed.getParam("media_types", "flash=swf;flv=flv;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.match(/watch\?v=(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
+ 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<fo.length; i++) {
+ c = fo[i].split('=');
+
+ el = c[1].split(',');
+ for (x=0; x<el.length; x++)
+ if (v.indexOf('.' + el[x]) != -1)
+ return c[0];
+ }
+
+ return null;
+}
+
+function switchType(v) {
+ var t = getType(v), d = document, f = d.forms[0];
+
+ if (!t)
+ return;
+
+ selectByValue(d.forms[0], 'media_type', t);
+ changedType(t);
+
+ // Update qtsrc also
+ if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {
+ alert(ed.getLang("media_qt_stream_warn"));
+
+ if (f.qt_qtsrc.value == '')
+ f.qt_qtsrc.value = f.src.value;
+ }
+}
+
+function changedType(t) {
+ var d = document;
+
+ d.getElementById('flash_options').style.display = 'none';
+ d.getElementById('flv_options').style.display = 'none';
+ d.getElementById('qt_options').style.display = 'none';
+ d.getElementById('shockwave_options').style.display = 'none';
+ d.getElementById('wmp_options').style.display = 'none';
+ d.getElementById('rmp_options').style.display = 'none';
+ d.getElementById(t + '_options').style.display = 'block';
+}
+
+function serializeParameters() {
+ var d = document, f = d.forms[0], s = '';
+
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ s += getBool('flash', 'play', true);
+ s += getBool('flash', 'loop', true);
+ s += getBool('flash', 'menu', true);
+ s += getBool('flash', 'swliveconnect', false);
+ s += getStr('flash', 'quality');
+ s += getStr('flash', 'scale');
+ s += getStr('flash', 'salign');
+ s += getStr('flash', 'wmode');
+ s += getStr('flash', 'base');
+ s += getStr('flash', 'flashvars');
+ break;
+
+ case "qt":
+ s += getBool('qt', 'loop', false);
+ s += getBool('qt', 'autoplay', true);
+ s += getBool('qt', 'cache', false);
+ s += getBool('qt', 'controller', true);
+ s += getBool('qt', 'correction', false, 'none', 'full');
+ s += getBool('qt', 'enablejavascript', false);
+ s += getBool('qt', 'kioskmode', false);
+ s += getBool('qt', 'autohref', false);
+ s += getBool('qt', 'playeveryframe', false);
+ s += getBool('qt', 'targetcache', false);
+ s += getStr('qt', 'scale');
+ s += getStr('qt', 'starttime');
+ s += getStr('qt', 'endtime');
+ s += getStr('qt', 'target');
+ s += getStr('qt', 'qtsrcchokespeed');
+ s += getStr('qt', 'volume');
+ s += getStr('qt', 'qtsrc');
+ break;
+
+ case "shockwave":
+ s += getBool('shockwave', 'sound');
+ s += getBool('shockwave', 'progress');
+ s += getBool('shockwave', 'autostart');
+ s += getBool('shockwave', 'swliveconnect');
+ s += getStr('shockwave', 'swvolume');
+ s += getStr('shockwave', 'swstretchstyle');
+ s += getStr('shockwave', 'swstretchhalign');
+ s += getStr('shockwave', 'swstretchvalign');
+ break;
+
+ case "wmp":
+ s += getBool('wmp', 'autostart', true);
+ s += getBool('wmp', 'enabled', false);
+ s += getBool('wmp', 'enablecontextmenu', true);
+ s += getBool('wmp', 'fullscreen', false);
+ s += getBool('wmp', 'invokeurls', true);
+ s += getBool('wmp', 'mute', false);
+ s += getBool('wmp', 'stretchtofit', false);
+ s += getBool('wmp', 'windowlessvideo', false);
+ s += getStr('wmp', 'balance');
+ s += getStr('wmp', 'baseurl');
+ s += getStr('wmp', 'captioningid');
+ s += getStr('wmp', 'currentmarker');
+ s += getStr('wmp', 'currentposition');
+ s += getStr('wmp', 'defaultframe');
+ s += getStr('wmp', 'playcount');
+ s += getStr('wmp', 'rate');
+ s += getStr('wmp', 'uimode');
+ s += getStr('wmp', 'volume');
+ break;
+
+ case "rmp":
+ s += getBool('rmp', 'autostart', false);
+ s += getBool('rmp', 'loop', false);
+ s += getBool('rmp', 'autogotourl', true);
+ s += getBool('rmp', 'center', false);
+ s += getBool('rmp', 'imagestatus', true);
+ s += getBool('rmp', 'maintainaspect', false);
+ s += getBool('rmp', 'nojava', false);
+ s += getBool('rmp', 'prefetch', false);
+ s += getBool('rmp', 'shuffle', false);
+ s += getStr('rmp', 'console');
+ s += getStr('rmp', 'controls');
+ s += getStr('rmp', 'numloop');
+ s += getStr('rmp', 'scriptcallbacks');
+ break;
+ }
+
+ s += getStr(null, 'id');
+ s += getStr(null, 'name');
+ s += getStr(null, 'src');
+ s += getStr(null, 'align');
+ s += getStr(null, 'bgcolor');
+ s += getInt(null, 'vspace');
+ s += getInt(null, 'hspace');
+ s += getStr(null, 'width');
+ s += getStr(null, 'height');
+
+ s = s.length > 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;
+
+ if (n == 'src')
+ v = tinyMCEPopup.editor.convertURL(v, 'src', null);
+
+ 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 = '<!-- x --->';
+
+ 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 = ed.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 = tinyMCEPopup.editor.plugins.media._parse(pl);
+
+ if (!pl.src) {
+ p.innerHTML = '';
+ return;
+ }
+
+ pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(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 += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+
+ for (n in pl) {
+ h += '<param name="' + n + '" value="' + pl[n] + '">';
+
+ // Add extra url parameter if it's an absolute URL
+ if (n == 'src' && pl[n].indexOf('://') != -1)
+ h += '<param name="url" value="' + pl[n] + '" />';
+ }
+
+ h += '<embed type="' + type + '" ';
+
+ for (n in pl)
+ h += n + '="' + pl[n] + '" ';
+
+ h += '></embed></object>';
+
+ p.innerHTML = "<!-- x --->" + h;
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/wp-includes/js/tinymce/plugins/media/media.htm b/wp-includes/js/tinymce/plugins/media/media.htm
new file mode 100644
index 0000000..32e0967
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/media/media.htm
@@ -0,0 +1,824 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#media_dlg.title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="js/media.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/validate.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <link href="css/media.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body style="display: none">
+ <form onsubmit="insertMedia();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#media_dlg.general}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="media_type">{#media_dlg.type}</label></td>
+ <td>
+ <select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();">
+ <option value="flash">Flash</option>
+ <!-- <option value="flv">Flash video (FLV)</option> -->
+ <option value="qt">Quicktime</option>
+ <option value="shockwave">Shockware</option>
+ <option value="wmp">Windows Media</option>
+ <option value="rmp">Real Media</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><label for="src">{#media_dlg.file}</label></td>
+ <td>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td>
+ <td id="filebrowsercontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr id="linklistrow">
+ <td><label for="linklist">{#media_dlg.list}</label></td>
+ <td id="linklistcontainer">&nbsp;</td>
+ </tr>
+ <tr>
+ <td><label for="width">{#media_dlg.size}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size" onchange="generatePreview('height');" /></td>
+ <td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
+ <td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset>
+ <legend>{#media_dlg.preview}</legend>
+ <div id="prev"></div>
+ </fieldset>
+ </div>
+
+ <div id="advanced_panel" class="panel">
+ <fieldset>
+ <legend>{#media_dlg.advanced}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0" width="100%">
+ <tr>
+ <td><label for="id">{#media_dlg.id}</label></td>
+ <td><input type="text" id="id" name="id" onchange="generatePreview();" /></td>
+ <td><label for="name">{#media_dlg.name}</label></td>
+ <td><input type="text" id="name" name="name" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="align">{#media_dlg.align}</label></td>
+ <td>
+ <select id="align" name="align" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="top">{#media_dlg.align_top}</option>
+ <option value="right">{#media_dlg.align_right}</option>
+ <option value="bottom">{#media_dlg.align_bottom}</option>
+ <option value="left">{#media_dlg.align_left}</option>
+ </select>
+ </td>
+
+ <td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>
+ <td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');generatePreview();" /></td>
+ <td id="bgcolor_pickcontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="vspace">{#media_dlg.vspace}</label></td>
+ <td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td>
+ <td><label for="hspace">{#media_dlg.hspace}</label></td>
+ <td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset id="flash_options">
+ <legend>{#media_dlg.flash_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="flash_quality">{#media_dlg.quality}</label></td>
+ <td>
+ <select id="flash_quality" name="flash_quality" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="high">high</option>
+ <option value="low">low</option>
+ <option value="autolow">autolow</option>
+ <option value="autohigh">autohigh</option>
+ <option value="best">best</option>
+ </select>
+ </td>
+
+ <td><label for="flash_scale">{#media_dlg.scale}</label></td>
+ <td>
+ <select id="flash_scale" name="flash_scale" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="showall">showall</option>
+ <option value="noborder">noborder</option>
+ <option value="exactfit">exactfit</option>
+ <option value="noscale">noscale</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="flash_wmode">{#media_dlg.wmode}</label></td>
+ <td>
+ <select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="window">window</option>
+ <option value="opaque">opaque</option>
+ <option value="transparent">transparent</option>
+ </select>
+ </td>
+
+ <td><label for="flash_salign">{#media_dlg.salign}</label></td>
+ <td>
+ <select id="flash_salign" name="flash_salign" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="l">{#media_dlg.align_left}</option>
+ <option value="t">{#media_dlg.align_top}</option>
+ <option value="r">{#media_dlg.align_right}</option>
+ <option value="b">{#media_dlg.align_bottom}</option>
+ <option value="tl">{#media_dlg.align_top_left}</option>
+ <option value="tr">{#media_dlg.align_top_right}</option>
+ <option value="bl">{#media_dlg.align_bottom_left}</option>
+ <option value="br">{#media_dlg.align_bottom_right}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flash_play">{#media_dlg.play}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flash_loop">{#media_dlg.loop}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flash_menu">{#media_dlg.menu}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td>
+ <td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ <table>
+ <tr>
+ <td><label for="flash_base">{#media_dlg.base}</label></td>
+ <td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
+ <td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset id="flv_options">
+ <legend>{#media_dlg.flv_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</label></td>
+ <td>
+ <select id="flv_scalemode" name="flv_scalemode" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="none">none</option>
+ <option value="double">double</option>
+ <option value="full">full</option>
+ </select>
+ </td>
+
+ <td><label for="flv_buffer">{#media_dlg.flv_buffer}</label></td>
+ <td><input type="text" id="flv_buffer" name="flv_buffer" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="flv_startimage">{#media_dlg.flv_startimage}</label></td>
+ <td><input type="text" id="flv_startimage" name="flv_startimage" onchange="generatePreview();" /></td>
+
+ <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
+ <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>
+ <td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>
+
+ <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
+ <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_hiddengui" name="flv_hiddengui" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_hiddengui">{#media_dlg.flv_hiddengui}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_autostart" name="flv_autostart" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_autostart">{#media_dlg.flv_autostart}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_loop" name="flv_loop" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_loop">{#media_dlg.flv_loop}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_showscalemodes" name="flv_showscalemodes" onchange="generatePreview();" /></td>
+ <td><label for="flv_showscalemodes">{#media_dlg.flv_showscalemodes}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_smoothvideo" name="flash_flv_flv_smoothvideosmoothvideo" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_smoothvideo">{#media_dlg.flv_smoothvideo}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_jscallback" name="flv_jscallback" onchange="generatePreview();" /></td>
+ <td><label for="flv_jscallback">{#media_dlg.flv_jscallback}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset id="qt_options">
+ <legend>{#media_dlg.qt_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td>
+ <td><label for="qt_loop">{#media_dlg.loop}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="qt_autoplay">{#media_dlg.play}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td>
+ <td><label for="qt_cache">{#media_dlg.cache}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="qt_controller">{#media_dlg.controller}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>
+ <td><label for="qt_correction">{#media_dlg.correction}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td>
+ <td><label for="qt_enablejavascript">{#media_dlg.enablejavascript}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>
+ <td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td>
+ <td><label for="qt_autohref">{#media_dlg.autohref}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>
+ <td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td>
+ <td><label for="qt_targetcache">{#media_dlg.targetcache}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="qt_scale">{#media_dlg.scale}</label></td>
+ <td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="tofit">tofit</option>
+ <option value="aspect">aspect</option>
+ </select>
+ </td>
+
+ <td colspan="2">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td><label for="qt_starttime">{#media_dlg.starttime}</label></td>
+ <td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td>
+
+ <td><label for="qt_endtime">{#media_dlg.endtime}</label></td>
+ <td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="qt_target">{#media_dlg.target}</label></td>
+ <td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td>
+
+ <td><label for="qt_href">{#media_dlg.href}</label></td>
+ <td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="qt_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
+ <td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td>
+
+ <td><label for="qt_volume">{#media_dlg.volume}</label></td>
+ <td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="qt_qtsrc">{#media_dlg.qtsrc}</label></td>
+ <td colspan="4">
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input type="text" id="qt_qtsrc" name="qt_qtsrc" onchange="generatePreview();" /></td>
+ <td id="qtsrcfilebrowsercontainer">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset id="wmp_options">
+ <legend>{#media_dlg.wmp_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="wmp_autostart">{#media_dlg.autostart}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td>
+ <td><label for="wmp_enabled">{#media_dlg.enabled}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td>
+ <td><label for="wmp_fullscreen">{#media_dlg.fullscreen}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td>
+ <td><label for="wmp_mute">{#media_dlg.mute}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>
+ <td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td>
+ <td><label for="wmp_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="wmp_balance">{#media_dlg.balance}</label></td>
+ <td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td>
+
+ <td><label for="wmp_baseurl">{#media_dlg.baseurl}</label></td>
+ <td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="wmp_captioningid">{#media_dlg.captioningid}</label></td>
+ <td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td>
+
+ <td><label for="wmp_currentmarker">{#media_dlg.currentmarker}</label></td>
+ <td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="wmp_currentposition">{#media_dlg.currentposition}</label></td>
+ <td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td>
+
+ <td><label for="wmp_defaultframe">{#media_dlg.defaultframe}</label></td>
+ <td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="wmp_playcount">{#media_dlg.playcount}</label></td>
+ <td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td>
+
+ <td><label for="wmp_rate">{#media_dlg.rate}</label></td>
+ <td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="wmp_uimode">{#media_dlg.uimode}</label></td>
+ <td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td>
+
+ <td><label for="wmp_volume">{#media_dlg.volume}</label></td>
+ <td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td>
+ </tr>
+
+ </table>
+ </fieldset>
+
+ <fieldset id="rmp_options">
+ <legend>{#media_dlg.rmp_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td>
+ <td><label for="rmp_autostart">{#media_dlg.autostart}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td>
+ <td><label for="rmp_loop">{#media_dlg.loop}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td>
+ <td><label for="rmp_center">{#media_dlg.center}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td>
+ <td><label for="rmp_maintainaspect">{#media_dlg.maintainaspect}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>
+ <td><label for="rmp_nojava">{#media_dlg.nojava}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td>
+ <td><label for="rmp_prefetch">{#media_dlg.prefetch}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>
+ <td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ &nbsp;
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="rmp_console">{#media_dlg.console}</label></td>
+ <td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td>
+
+ <td><label for="rmp_controls">{#media_dlg.controls}</label></td>
+ <td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="rmp_numloop">{#media_dlg.numloop}</label></td>
+ <td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td>
+
+ <td><label for="rmp_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
+ <td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset id="shockwave_options">
+ <legend>{#media_dlg.shockwave_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
+ <td>
+ <select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">
+ <option value="none">{#not_set}</option>
+ <option value="meet">Meet</option>
+ <option value="fill">Fill</option>
+ <option value="stage">Stage</option>
+ </select>
+ </td>
+
+ <td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>
+ <td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
+ <td>
+ <select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">
+ <option value="none">{#not_set}</option>
+ <option value="left">{#media_dlg.align_left}</option>
+ <option value="center">{#media_dlg.align_center}</option>
+ <option value="right">{#media_dlg.align_right}</option>
+ </select>
+ </td>
+
+ <td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>
+ <td>
+ <select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">
+ <option value="none">{#not_set}</option>
+ <option value="meet">Meet</option>
+ <option value="fill">Fill</option>
+ <option value="stage">Stage</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td>
+ <td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td>
+ <td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>
+ <td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td>
+ <td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+
+ <div style="float: right">
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ </div>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/wp-includes/js/tinymce/plugins/paste/images/pastetext.gif b/wp-includes/js/tinymce/plugins/paste/images/pastetext.gif
deleted file mode 100644
index e381cc6..0000000
--- a/wp-includes/js/tinymce/plugins/paste/images/pastetext.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/paste/images/pasteword.gif b/wp-includes/js/tinymce/plugins/paste/images/pasteword.gif
deleted file mode 100644
index 0ccb008..0000000
--- a/wp-includes/js/tinymce/plugins/paste/images/pasteword.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/paste/images/selectall.gif b/wp-includes/js/tinymce/plugins/paste/images/selectall.gif
deleted file mode 100644
index c4f9901..0000000
--- a/wp-includes/js/tinymce/plugins/paste/images/selectall.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js b/wp-includes/js/tinymce/plugins/paste/js/pastetext.js
index 4c07691..2807387 100644
--- a/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js
+++ b/wp-includes/js/tinymce/plugins/paste/js/pastetext.js
@@ -1,38 +1,42 @@
-function saveContent() {
- if (document.forms[0].htmlSource.value == '') {
- tinyMCEPopup.close();
- return false;
- }
-
- tinyMCEPopup.execCommand('mcePasteText', false, {
- html : document.forms[0].htmlSource.value,
- linebreaks : document.forms[0].linebreaks.checked
- });
-
- tinyMCEPopup.close();
-}
-
-function onLoadInit() {
- tinyMCEPopup.resizeToInnerSize();
-
- // Remove Gecko spellchecking
- if (tinyMCE.isGecko)
- document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
-
- resizeInputs();
-}
-
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
-
-function resizeInputs() {
- if (!tinyMCE.isMSIE) {
- wHeight = self.innerHeight-80;
- wWidth = self.innerWidth-17;
- } else {
- wHeight = document.body.clientHeight-80;
- wWidth = document.body.clientWidth-17;
- }
-
- document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
- document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
-}
+tinyMCEPopup.requireLangPack();
+
+function saveContent() {
+ if (document.forms[0].htmlSource.value == '') {
+ tinyMCEPopup.close();
+ return false;
+ }
+
+ tinyMCEPopup.execCommand('mcePasteText', false, {
+ html : document.forms[0].htmlSource.value,
+ linebreaks : document.forms[0].linebreaks.checked
+ });
+
+ tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // Remove Gecko spellchecking
+ if (tinymce.isGecko)
+ document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
+
+ resizeInputs();
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function resizeInputs() {
+ if (!tinymce.isIE) {
+ wHeight = self.innerHeight-80;
+ wWidth = self.innerWidth-17;
+ } else {
+ wHeight = document.body.clientHeight-80;
+ wWidth = document.body.clientWidth-17;
+ }
+
+ document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
+ document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
+}
+
+tinyMCEPopup.onInit.add(onLoadInit); \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js b/wp-includes/js/tinymce/plugins/paste/js/pasteword.js
index b243a10..ea9c29c 100644
--- a/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js
+++ b/wp-includes/js/tinymce/plugins/paste/js/pasteword.js
@@ -1,52 +1,56 @@
-function saveContent() {
- var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
-
- if (html == ''){
- tinyMCEPopup.close();
- return false;
- }
-
- tinyMCEPopup.execCommand('mcePasteWord', false, html);
- tinyMCEPopup.close();
-}
-
-function onLoadInit() {
- tinyMCEPopup.resizeToInnerSize();
-
- // Fix for endless reloading in FF
- window.setTimeout('createIFrame();', 10);
-}
-
-function createIFrame() {
- document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
-}
-
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
-
-function initIframe(doc) {
- var dir = tinyMCE.selectedInstance.settings['directionality'];
-
- doc.body.dir = dir;
-
- // Remove Gecko spellchecking
- if (tinyMCE.isGecko)
- doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
-
- resizeInputs();
-}
-
-function resizeInputs() {
- if (!tinyMCE.isMSIE) {
- wHeight = self.innerHeight - 80;
- wWidth = self.innerWidth - 18;
- } else {
- wHeight = document.body.clientHeight - 80;
- wWidth = document.body.clientWidth - 18;
- }
-
- var elm = document.getElementById('frmData');
- if (elm) {
- elm.style.height = Math.abs(wHeight) + 'px';
- elm.style.width = Math.abs(wWidth) + 'px';
- }
-}
+tinyMCEPopup.requireLangPack();
+
+function saveContent() {
+ var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
+
+ if (html == ''){
+ tinyMCEPopup.close();
+ return false;
+ }
+
+ tinyMCEPopup.execCommand('mcePasteWord', false, html);
+ tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // Fix for endless reloading in FF
+ window.setTimeout(createIFrame, 10);
+}
+
+function createIFrame() {
+ document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function initIframe(doc) {
+ var dir = tinyMCEPopup.editor.settings.directionality;
+
+ doc.body.dir = dir;
+
+ // Remove Gecko spellchecking
+ if (tinymce.isGecko)
+ doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
+
+ resizeInputs();
+}
+
+function resizeInputs() {
+ if (!tinymce.isIE) {
+ wHeight = self.innerHeight - 80;
+ wWidth = self.innerWidth - 18;
+ } else {
+ wHeight = document.body.clientHeight - 80;
+ wWidth = document.body.clientWidth - 18;
+ }
+
+ var elm = document.getElementById('frmData');
+ if (elm) {
+ elm.style.height = Math.abs(wHeight) + 'px';
+ elm.style.width = Math.abs(wWidth) + 'px';
+ }
+}
+
+tinyMCEPopup.onInit.add(onLoadInit);
diff --git a/wp-includes/js/tinymce/plugins/paste/langs/en.js b/wp-includes/js/tinymce/plugins/paste/langs/en.js
deleted file mode 100644
index b125d51..0000000
--- a/wp-includes/js/tinymce/plugins/paste/langs/en.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-paste_text_desc : 'Paste as Plain Text',
-paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
-paste_text_linebreaks : 'Keep linebreaks',
-paste_word_desc : 'Paste from Word',
-paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
-selectall_desc : 'Select All'
-});
diff --git a/wp-includes/js/tinymce/plugins/safari/blank.htm b/wp-includes/js/tinymce/plugins/safari/blank.htm
new file mode 100644
index 0000000..266808c
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/safari/blank.htm
@@ -0,0 +1 @@
+<!-- WebKit --> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/safari/editor_plugin.js b/wp-includes/js/tinymce/plugins/safari/editor_plugin.js
new file mode 100644
index 0000000..960fc71
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/safari/editor_plugin.js
@@ -0,0 +1 @@
+(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.onKeyUp.add(function(ed,e){var h;if(e.keyCode==46||e.keyCode==8){h=ed.getBody().innerHTML;if(!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'<span id="_mce_tmp">XX</span>');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&(e.shiftKey||ed.settings.force_br_newlines&&ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onBeforeExecCommand.add(function(ed,c,b){var r=t.bookmarkRng;if(r){ed.selection.setRng(r);t.bookmarkRng=null;}});ed.onInit.add(function(){t._fixWebKitSpans();ed.windowManager.onOpen.add(function(){var r=ed.selection.getRng();if(r.startContainer!=ed.getDoc()){t.bookmarkRng=r.cloneRange();}});ed.windowManager.onClose.add(function(){t.bookmarkRng=null;});if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,'</$1>');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})(); \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
new file mode 100644
index 0000000..00c9f9f
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
@@ -0,0 +1,158 @@
+<?php
+/**
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+class GoogleSpell extends SpellChecker {
+ /**
+ * Spellchecks an array of words.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {Array} $words Array of words to spellcheck.
+ * @return {Array} Array of misspelled words.
+ */
+ function &checkWords($lang, $words) {
+ $wordstr = implode(' ', $words);
+ $matches = $this->_getMatches($lang, $wordstr);
+ $words = array();
+
+ for ($i=0; $i<count($matches); $i++)
+ $words[] = $this->_unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
+
+ return $words;
+ }
+
+ /**
+ * Returns suggestions of for a specific word.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {String} $word Specific word to get suggestions for.
+ * @return {Array} Array of suggestions for the specified word.
+ */
+ function &getSuggestions($lang, $word) {
+ $sug = array();
+ $osug = array();
+ $matches = $this->_getMatches($lang, $word);
+
+ if (count($matches) > 0)
+ $sug = explode("\t", utf8_encode($this->_unhtmlentities($matches[0][4])));
+
+ // Remove empty
+ foreach ($sug as $item) {
+ if ($item)
+ $osug[] = $item;
+ }
+
+ return $osug;
+ }
+
+ function &_getMatches($lang, $str) {
+ $server = "www.google.com";
+ $port = 443;
+ $path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
+ $host = "www.google.com";
+ $url = "https://" . $server;
+
+ // Setup XML request
+ $xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $str . '</text></spellrequest>';
+
+ $header = "POST ".$path." HTTP/1.0 \r\n";
+ $header .= "MIME-Version: 1.0 \r\n";
+ $header .= "Content-type: application/PTI26 \r\n";
+ $header .= "Content-length: ".strlen($xml)." \r\n";
+ $header .= "Content-transfer-encoding: text \r\n";
+ $header .= "Request-number: 1 \r\n";
+ $header .= "Document-type: Request \r\n";
+ $header .= "Interface-Version: Test 1.4 \r\n";
+ $header .= "Connection: close \r\n\r\n";
+ $header .= $xml;
+
+ // Use curl if it exists
+ if (function_exists('curl_init')) {
+ // Use curl
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL,$url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ $xml = curl_exec($ch);
+ curl_close($ch);
+ } else {
+ // Use raw sockets
+ $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30);
+ if ($fp) {
+ // Send request
+ fwrite($fp, $header);
+
+ // Read response
+ $xml = "";
+ while (!feof($fp))
+ $xml .= fgets($fp, 128);
+
+ fclose($fp);
+ } else
+ echo "Could not open SSL connection to google.";
+ }
+
+ // Grab and parse content
+ $matches = array();
+ preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
+
+ return $matches;
+ }
+
+ function _unhtmlentities($string) {
+ $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
+ $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
+
+ $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+ $trans_tbl = array_flip($trans_tbl);
+
+ return strtr($string, $trans_tbl);
+ }
+}
+
+// Patch in multibyte support
+if (!function_exists('mb_substr')) {
+ function mb_substr($str, $start, $len = '', $encoding="UTF-8"){
+ $limit = strlen($str);
+
+ for ($s = 0; $start > 0;--$start) {// found the real start
+ if ($s >= $limit)
+ break;
+
+ if ($str[$s] <= "\x7F")
+ ++$s;
+ else {
+ ++$s; // skip length
+
+ while ($str[$s] >= "\x80" && $str[$s] <= "\xBF")
+ ++$s;
+ }
+ }
+
+ if ($len == '')
+ return substr($str, $s);
+ else
+ for ($e = $s; $len > 0; --$len) {//found the real end
+ if ($e >= $limit)
+ break;
+
+ if ($str[$e] <= "\x7F")
+ ++$e;
+ else {
+ ++$e;//skip length
+
+ while ($str[$e] >= "\x80" && $str[$e] <= "\xBF" && $e < $limit)
+ ++$e;
+ }
+ }
+
+ return substr($str, $s, $e - $s);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php
deleted file mode 100755
index cae27f0..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php
+++ /dev/null
@@ -1,339 +0,0 @@
-<?php
-
-/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
- Manual: http://scripts.incutio.com/httpclient/
-*/
-
-class HttpClient {
- // Request vars
- var $host;
- var $port;
- var $path;
- var $method;
- var $postdata = '';
- var $cookies = array();
- var $referer;
- var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
- var $accept_encoding = 'gzip';
- var $accept_language = 'en-us';
- var $user_agent = 'Incutio HttpClient v0.9';
- // Options
- var $timeout = 20;
- var $use_gzip = true;
- var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request
- // Note: This currently ignores the cookie path (and time) completely. Time is not important,
- // but path could possibly lead to security problems.
- var $persist_referers = true; // For each request, sends path of last request as referer
- var $debug = false;
- var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
- var $max_redirects = 5;
- var $headers_only = false; // If true, stops receiving once headers have been read.
- // Basic authorization variables
- var $username;
- var $password;
- // Response vars
- var $status;
- var $headers = array();
- var $content = '';
- var $errormsg;
- // Tracker variables
- var $redirect_count = 0;
- var $cookie_host = '';
- function HttpClient($host, $port=80) {
- $this->host = $host;
- $this->port = $port;
- }
- function get($path, $data = false) {
- $this->path = $path;
- $this->method = 'GET';
- if ($data) {
- $this->path .= '?'.$this->buildQueryString($data);
- }
- return $this->doRequest();
- }
- function post($path, $data) {
- $this->path = $path;
- $this->method = 'POST';
- $this->postdata = $this->buildQueryString($data);
- return $this->doRequest();
- }
- function buildQueryString($data) {
- $querystring = '';
- if (is_array($data)) {
- // Change data in to postable data
- foreach ($data as $key => $val) {
- if (is_array($val)) {
- foreach ($val as $val2) {
- $querystring .= urlencode($key).'='.urlencode($val2).'&';
- }
- } else {
- $querystring .= urlencode($key).'='.urlencode($val).'&';
- }
- }
- $querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
- } else {
- $querystring = $data;
- }
- return $querystring;
- }
- function doRequest() {
- // Performs the actual HTTP request, returning true or false depending on outcome
- if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) {
- // Set error message
- switch($errno) {
- case -3:
- $this->errormsg = 'Socket creation failed (-3)';
- case -4:
- $this->errormsg = 'DNS lookup failure (-4)';
- case -5:
- $this->errormsg = 'Connection refused or timed out (-5)';
- default:
- $this->errormsg = 'Connection failed ('.$errno.')';
- $this->errormsg .= ' '.$errstr;
- $this->debug($this->errormsg);
- }
- return false;
- }
- socket_set_timeout($fp, $this->timeout);
- $request = $this->buildRequest();
- $this->debug('Request', $request);
- fwrite($fp, $request);
- // Reset all the variables that should not persist between requests
- $this->headers = array();
- $this->content = '';
- $this->errormsg = '';
- // Set a couple of flags
- $inHeaders = true;
- $atStart = true;
- // Now start reading back the response
- while (!feof($fp)) {
- $line = fgets($fp, 4096);
- if ($atStart) {
- // Deal with first line of returned data
- $atStart = false;
- if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
- $this->errormsg = "Status code line invalid: ".htmlentities($line);
- $this->debug($this->errormsg);
- return false;
- }
- $http_version = $m[1]; // not used
- $this->status = $m[2];
- $status_string = $m[3]; // not used
- $this->debug(trim($line));
- continue;
- }
- if ($inHeaders) {
- if (trim($line) == '') {
- $inHeaders = false;
- $this->debug('Received Headers', $this->headers);
- if ($this->headers_only) {
- break; // Skip the rest of the input
- }
- continue;
- }
- if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
- // Skip to the next header
- continue;
- }
- $key = strtolower(trim($m[1]));
- $val = trim($m[2]);
- // Deal with the possibility of multiple headers of same name
- if (isset($this->headers[$key])) {
- if (is_array($this->headers[$key])) {
- $this->headers[$key][] = $val;
- } else {
- $this->headers[$key] = array($this->headers[$key], $val);
- }
- } else {
- $this->headers[$key] = $val;
- }
- continue;
- }
- // We're not in the headers, so append the line to the contents
- $this->content .= $line;
- }
- fclose($fp);
- // If data is compressed, uncompress it
- if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
- $this->debug('Content is gzip encoded, unzipping it');
- $this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
- $this->content = gzinflate($this->content);
- }
- // If $persist_cookies, deal with any cookies
- if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
- $cookies = $this->headers['set-cookie'];
- if (!is_array($cookies)) {
- $cookies = array($cookies);
- }
- foreach ($cookies as $cookie) {
- if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
- $this->cookies[$m[1]] = $m[2];
- }
- }
- // Record domain of cookies for security reasons
- $this->cookie_host = $this->host;
- }
- // If $persist_referers, set the referer ready for the next request
- if ($this->persist_referers) {
- $this->debug('Persisting referer: '.$this->getRequestURL());
- $this->referer = $this->getRequestURL();
- }
- // Finally, if handle_redirects and a redirect is sent, do that
- if ($this->handle_redirects) {
- if (++$this->redirect_count >= $this->max_redirects) {
- $this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
- $this->debug($this->errormsg);
- $this->redirect_count = 0;
- return false;
- }
- $location = isset($this->headers['location']) ? $this->headers['location'] : '';
- $uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
- if ($location || $uri) {
- $url = parse_url($location.$uri);
- // This will FAIL if redirect is to a different site
- return $this->get($url['path']);
- }
- }
- return true;
- }
- function buildRequest() {
- $headers = array();
- $headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
- $headers[] = "Host: {$this->host}";
- $headers[] = "User-Agent: {$this->user_agent}";
- $headers[] = "Accept: {$this->accept}";
- if ($this->use_gzip) {
- $headers[] = "Accept-encoding: {$this->accept_encoding}";
- }
- $headers[] = "Accept-language: {$this->accept_language}";
- if ($this->referer) {
- $headers[] = "Referer: {$this->referer}";
- }
- // Cookies
- if ($this->cookies) {
- $cookie = 'Cookie: ';
- foreach ($this->cookies as $key => $value) {
- $cookie .= "$key=$value; ";
- }
- $headers[] = $cookie;
- }
- // Basic authentication
- if ($this->username && $this->password) {
- $headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
- }
- // If this is a POST, set the content type and length
- if ($this->postdata) {
- $headers[] = 'Content-Type: application/x-www-form-urlencoded';
- $headers[] = 'Content-Length: '.strlen($this->postdata);
- }
- $request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
- return $request;
- }
- function getStatus() {
- return $this->status;
- }
- function getContent() {
- return $this->content;
- }
- function getHeaders() {
- return $this->headers;
- }
- function getHeader($header) {
- $header = strtolower($header);
- if (isset($this->headers[$header])) {
- return $this->headers[$header];
- } else {
- return false;
- }
- }
- function getError() {
- return $this->errormsg;
- }
- function getCookies() {
- return $this->cookies;
- }
- function getRequestURL() {
- $url = 'http://'.$this->host;
- if ($this->port != 80) {
- $url .= ':'.$this->port;
- }
- $url .= $this->path;
- return $url;
- }
- // Setter methods
- function setUserAgent($string) {
- $this->user_agent = $string;
- }
- function setAuthorization($username, $password) {
- $this->username = $username;
- $this->password = $password;
- }
- function setCookies($array) {
- $this->cookies = $array;
- }
- // Option setting methods
- function useGzip($boolean) {
- $this->use_gzip = $boolean;
- }
- function setPersistCookies($boolean) {
- $this->persist_cookies = $boolean;
- }
- function setPersistReferers($boolean) {
- $this->persist_referers = $boolean;
- }
- function setHandleRedirects($boolean) {
- $this->handle_redirects = $boolean;
- }
- function setMaxRedirects($num) {
- $this->max_redirects = $num;
- }
- function setHeadersOnly($boolean) {
- $this->headers_only = $boolean;
- }
- function setDebug($boolean) {
- $this->debug = $boolean;
- }
- // "Quick" static methods
- function quickGet($url) {
- $bits = parse_url($url);
- $host = $bits['host'];
- $port = isset($bits['port']) ? $bits['port'] : 80;
- $path = isset($bits['path']) ? $bits['path'] : '/';
- if (isset($bits['query'])) {
- $path .= '?'.$bits['query'];
- }
- $client = new HttpClient($host, $port);
- if (!$client->get($path)) {
- return false;
- } else {
- return $client->getContent();
- }
- }
- function quickPost($url, $data) {
- $bits = parse_url($url);
- $host = $bits['host'];
- $port = isset($bits['port']) ? $bits['port'] : 80;
- $path = isset($bits['path']) ? $bits['path'] : '/';
- $client = new HttpClient($host, $port);
- if (!$client->post($path, $data)) {
- return false;
- } else {
- return $client->getContent();
- }
- }
- function debug($msg, $object = false) {
- if ($this->debug) {
- print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
- if ($object) {
- ob_start();
- print_r($object);
- $content = htmlentities(ob_get_contents());
- ob_end_clean();
- print '<pre>'.$content.'</pre>';
- }
- print '</div>';
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
new file mode 100644
index 0000000..48af873
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+class PSpell extends SpellChecker {
+ /**
+ * Spellchecks an array of words.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {Array} $words Array of words to spellcheck.
+ * @return {Array} Array of misspelled words.
+ */
+ function &checkWords($lang, $words) {
+ $plink = $this->_getPLink($lang);
+
+ $outWords = array();
+ foreach ($words as $word) {
+ if (!pspell_check($plink, trim($word)))
+ $outWords[] = utf8_encode($word);
+ }
+
+ return $outWords;
+ }
+
+ /**
+ * Returns suggestions of for a specific word.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {String} $word Specific word to get suggestions for.
+ * @return {Array} Array of suggestions for the specified word.
+ */
+ function &getSuggestions($lang, $word) {
+ $words = pspell_suggest($this->_getPLink($lang), $word);
+
+ for ($i=0; $i<count($words); $i++)
+ $words[$i] = utf8_encode($words[$i]);
+
+ return $words;
+ }
+
+ /**
+ * Opens a link for pspell.
+ */
+ function &_getPLink($lang) {
+ // Check for native PSpell support
+ if (!function_exists("pspell_new"))
+ $this->throwError("PSpell support not found in PHP installation.");
+
+ // Setup PSpell link
+ $plink = pspell_new(
+ $lang,
+ $this->_config['PSpell.spelling'],
+ $this->_config['PSpell.jargon'],
+ $this->_config['PSpell.encoding'],
+ $this->_config['PSpell.mode']
+ );
+
+ // Setup PSpell link
+/* if (!$plink) {
+ $pspellConfig = pspell_config_create(
+ $lang,
+ $this->_config['PSpell.spelling'],
+ $this->_config['PSpell.jargon'],
+ $this->_config['PSpell.encoding']
+ );
+
+ $plink = pspell_new_config($pspell_config);
+ }*/
+
+ if (!$plink)
+ $this->throwError("No PSpell link found opened.");
+
+ return $plink;
+ }
+}
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
new file mode 100644
index 0000000..779e837
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
@@ -0,0 +1,112 @@
+<?php
+/**
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+class PSpellShell extends SpellChecker {
+ /**
+ * Spellchecks an array of words.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {Array} $words Array of words to spellcheck.
+ * @return {Array} Array of misspelled words.
+ */
+ function &checkWords($lang, $words) {
+ $cmd = $this->_getCMD($lang);
+
+ if ($fh = fopen($this->_tmpfile, "w")) {
+ fwrite($fh, "!\n");
+
+ foreach($words as $key => $value)
+ fwrite($fh, "^" . $value . "\n");
+
+ fclose($fh);
+ } else
+ $this->throwError("PSpell support was not found.");
+
+ $data = shell_exec($cmd);
+ @unlink($this->_tmpfile);
+
+ $returnData = array();
+ $dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY);
+
+ foreach ($dataArr as $dstr) {
+ $matches = array();
+
+ // Skip this line.
+ if (strpos($dstr, "@") === 0)
+ continue;
+
+ preg_match("/\& ([^ ]+) .*/i", $dstr, $matches);
+
+ if (!empty($matches[1]))
+ $returnData[] = utf8_encode(trim($matches[1]));
+ }
+
+ return $returnData;
+ }
+
+ /**
+ * Returns suggestions of for a specific word.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {String} $word Specific word to get suggestions for.
+ * @return {Array} Array of suggestions for the specified word.
+ */
+ function &getSuggestions($lang, $word) {
+ $cmd = $this->_getCMD($lang);
+
+ if (function_exists("mb_convert_encoding"))
+ $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
+ else
+ $word = utf8_encode($word);
+
+ if ($fh = fopen($this->_tmpfile, "w")) {
+ fwrite($fh, "!\n");
+ fwrite($fh, "^$word\n");
+ fclose($fh);
+ } else
+ $this->throwError("Error opening tmp file.");
+
+ $data = shell_exec($cmd);
+ @unlink($this->_tmpfile);
+
+ $returnData = array();
+ $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
+
+ foreach($dataArr as $dstr) {
+ $matches = array();
+
+ // Skip this line.
+ if (strpos($dstr, "@") === 0)
+ continue;
+
+ preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
+
+ if (!empty($matches[1])) {
+ $words = array_slice(explode(',', $matches[1]), 0, 10);
+
+ for ($i=0; $i<count($words); $i++)
+ $words[$i] = trim($words[$i]);
+
+ return $words;
+ }
+ }
+
+ return array();
+ }
+
+ function _getCMD($lang) {
+ $this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
+
+ if(preg_match("#win#i", php_uname()))
+ return $this->_config['PSpellShell.aspell'] . " -a --lang=". $lang . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1";
+
+ return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". $lang;
+ }
+}
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
new file mode 100644
index 0000000..ca7b143
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+class SpellChecker {
+ /**
+ * Constructor.
+ *
+ * @param $config Configuration name/value array.
+ */
+ function SpellChecker(&$config) {
+ $this->_config = $config;
+ }
+
+ /**
+ * Simple loopback function everything that gets in will be send back.
+ *
+ * @param $args.. Arguments.
+ * @return {Array} Array of all input arguments.
+ */
+ function &loopback(/* args.. */) {
+ return func_get_args();
+ }
+
+ /**
+ * Spellchecks an array of words.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {Array} $words Array of words to spellcheck.
+ * @return {Array} Array of misspelled words.
+ */
+ function &checkWords($lang, $words) {
+ return $words;
+ }
+
+ /**
+ * Returns suggestions of for a specific word.
+ *
+ * @param {String} $lang Language code like sv or en.
+ * @param {String} $word Specific word to get suggestions for.
+ * @return {Array} Array of suggestions for the specified word.
+ */
+ function &getSuggestions($lang, $word) {
+ return array();
+ }
+
+ /**
+ * Throws an error message back to the user. This will stop all execution.
+ *
+ * @param {String} $str Message to send back to user.
+ */
+ function throwError($str) {
+ die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
+ }
+}
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php
deleted file mode 100755
index 0127ff1..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/* *
- * Tiny Spelling Interface for TinyMCE Spell Checking.
- *
- * Copyright © 2006 Moxiecode Systems AB
- */
-
-class TinyGoogleSpell {
- var $lang;
-
- function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
- $this->lang = $lang;
- }
-
- // Returns array with bad words or false if failed.
- function checkWords($word_array) {
- $words = array();
- $wordstr = implode(' ', $word_array);
-
- $matches = $this->_getMatches($wordstr);
-
- for ($i=0; $i<count($matches); $i++)
- $words[] = $this->unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
-
- return $words;
- }
-
- function unhtmlentities($string) {
- $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
- $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
-
- $trans_tbl = get_html_translation_table(HTML_ENTITIES);
- $trans_tbl = array_flip($trans_tbl);
-
- return strtr($string, $trans_tbl);
- }
-
- // Returns array with suggestions or false if failed.
- function getSuggestion($word) {
- $sug = array();
-
- $matches = $this->_getMatches($word);
-
- if (count($matches) > 0)
- $sug = explode("\t", utf8_encode($this->unhtmlentities($matches[0][4])));
-
- return $sug;
- }
-
- function _xmlChars($string) {
- $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
-
- foreach ($trans as $k => $v)
- $trans[$k] = "&#".ord($k).";";
-
- return strtr($string, $trans);
- }
-
- function _getMatches($word_list) {
- $server = "www.google.com";
- $port = 443;
- $path = "/tbproxy/spell?lang=" . $this->lang . "&hl=en";
- $host = "www.google.com";
- $url = "https://" . $server;
-
- // Setup XML request
- $xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $word_list . '</text></spellrequest>';
-
- $header = "POST ".$path." HTTP/1.0 \r\n";
- $header .= "MIME-Version: 1.0 \r\n";
- $header .= "Content-type: application/PTI26 \r\n";
- $header .= "Content-length: ".strlen($xml)." \r\n";
- $header .= "Content-transfer-encoding: text \r\n";
- $header .= "Request-number: 1 \r\n";
- $header .= "Document-type: Request \r\n";
- $header .= "Interface-Version: Test 1.4 \r\n";
- $header .= "Connection: close \r\n\r\n";
- $header .= $xml;
- //$this->_debugData($xml);
-
- // Use curl if it exists
- if (function_exists('curl_init')) {
- // Use curl
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- $xml = curl_exec($ch);
- curl_close($ch);
- } else {
- // Use raw sockets
- $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30);
- if ($fp) {
- // Send request
- fwrite($fp, $header);
-
- // Read response
- $xml = "";
- while (!feof($fp))
- $xml .= fgets($fp, 128);
-
- fclose($fp);
- } else
- echo "Could not open SSL connection to google.";
- }
-
- //$this->_debugData($xml);
-
- // Grab and parse content
- preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
-
- return $matches;
- }
-
- function _debugData($data) {
- $fh = @fopen("debug.log", 'a+');
- @fwrite($fh, $data);
- @fclose($fh);
- }
-}
-
-// Setup classname, should be the same as the name of the spellchecker class
-$spellCheckerConfig['class'] = "TinyGoogleSpell";
-
-?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php
deleted file mode 100755
index 21fb194..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/* *
- * Tiny Spelling Interface for TinyMCE Spell Checking.
- *
- * Copyright © 2006 Moxiecode Systems AB
- *
- */
-
-class TinyPSpell {
- var $lang;
- var $mode;
- var $string;
- var $plink;
- var $errorMsg;
-
- var $jargon;
- var $spelling;
- var $encoding;
-
- function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
- $this->lang = $lang;
- $this->mode = $mode;
- $this->plink = false;
- $this->errorMsg = array();
-
- if (!function_exists("pspell_new")) {
- $this->errorMsg[] = "PSpell not found.";
- return;
- }
-
- $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
- }
-
- // Returns array with bad words or false if failed.
- function checkWords($wordArray) {
- if (!$this->plink) {
- $this->errorMsg[] = "No PSpell link found for checkWords.";
- return array();
- }
-
- $wordError = array();
- foreach($wordArray as $word) {
- if(!pspell_check($this->plink, trim($word)))
- $wordError[] = $word;
- }
-
- return $wordError;
- }
-
- // Returns array with suggestions or false if failed.
- function getSuggestion($word) {
- if (!$this->plink) {
- $this->errorMsg[] = "No PSpell link found for getSuggestion.";
- return array();
- }
-
- return pspell_suggest($this->plink, $word);
- }
-}
-
-// Setup classname, should be the same as the name of the spellchecker class
-$spellCheckerConfig['class'] = "TinyPspell";
-
-?> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php
deleted file mode 100755
index 5723d2f..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/* *
- * Tiny Spelling Interface for TinyMCE Spell Checking.
- *
- * Copyright © 2006 Moxiecode Systems AB
- *
- */
-
-
-class TinyPspellShell {
- var $lang;
- var $mode;
- var $string;
- var $error;
- var $errorMsg;
-
- var $cmd;
- var $tmpfile;
-
- var $jargon;
- var $spelling;
- var $encoding;
-
- function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
- $this->lang = $lang;
- $this->mode = $mode;
- $this->error = false;
- $this->errorMsg = array();
-
- $this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
-
- if(preg_match("#win#i",php_uname()))
- $this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1";
- else
- $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang;
- }
-
- // Returns array with bad words or false if failed.
- function checkWords($wordArray) {
- if ($fh = fopen($this->tmpfile, "w")) {
- fwrite($fh, "!\n");
- foreach($wordArray as $key => $value)
- fwrite($fh, "^" . $value . "\n");
- fclose($fh);
- } else {
- $this->errorMsg[] = "PSpell not found.";
- return array();
- }
-
- $data = shell_exec($this->cmd);
- @unlink($this->tmpfile);
-
- $returnData = array();
- $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
-
- foreach($dataArr as $dstr) {
- $matches = array();
-
- // Skip this line.
- if (strpos($dstr, "@") === 0)
- continue;
-
- preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
-
- if (!empty($matches[1]))
- $returnData[] = $matches[1];
- }
-
- return $returnData;
- }
-
- // Returns array with suggestions or false if failed.
- function getSuggestion($word) {
- if (function_exists("mb_convert_encoding"))
- $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
- else
- $word = utf8_encode($word);
-
- if ($fh = fopen($this->tmpfile, "w")) {
- fwrite($fh, "!\n");
- fwrite($fh, "^$word\n");
- fclose($fh);
- } else
- die("Error opening tmp file.");
-
- $data = shell_exec($this->cmd);
-
- @unlink($this->tmpfile);
-
- $returnData = array();
- $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
-
- foreach($dataArr as $dstr) {
- $matches = array();
-
- // Skip this line.
- if (strpos($dstr, "@") === 0)
- continue;
-
- preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
-
- if (!empty($matches[1])) {
- // For some reason, the exec version seems to add commas?
- $returnData[] = str_replace(",", "", $matches[1]);
- }
- }
- return $returnData;
- }
-
- function _debugData($data) {
- $fh = @fopen("debug.log", 'a+');
- @fwrite($fh, $data);
- @fclose($fh);
- }
-
-}
-
-// Setup classname, should be the same as the name of the spellchecker class
-$spellCheckerConfig['class'] = "TinyPspellShell";
-
-?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
new file mode 100644
index 0000000..1c46116
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
@@ -0,0 +1,595 @@
+<?php
+/**
+ * $Id: JSON.php 40 2007-06-18 11:43:15Z spocke $
+ *
+ * @package MCManager.utils
+ * @author Moxiecode
+ * @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+define('JSON_BOOL', 1);
+define('JSON_INT', 2);
+define('JSON_STR', 3);
+define('JSON_FLOAT', 4);
+define('JSON_NULL', 5);
+define('JSON_START_OBJ', 6);
+define('JSON_END_OBJ', 7);
+define('JSON_START_ARRAY', 8);
+define('JSON_END_ARRAY', 9);
+define('JSON_KEY', 10);
+define('JSON_SKIP', 11);
+
+define('JSON_IN_ARRAY', 30);
+define('JSON_IN_OBJECT', 40);
+define('JSON_IN_BETWEEN', 50);
+
+class Moxiecode_JSONReader {
+ var $_data, $_len, $_pos;
+ var $_value, $_token;
+ var $_location, $_lastLocations;
+ var $_needProp;
+
+ function Moxiecode_JSONReader($data) {
+ $this->_data = $data;
+ $this->_len = strlen($data);
+ $this->_pos = -1;
+ $this->_location = JSON_IN_BETWEEN;
+ $this->_lastLocations = array();
+ $this->_needProp = false;
+ }
+
+ function getToken() {
+ return $this->_token;
+ }
+
+ function getLocation() {
+ return $this->_location;
+ }
+
+ function getTokenName() {
+ switch ($this->_token) {
+ case JSON_BOOL:
+ return 'JSON_BOOL';
+
+ case JSON_INT:
+ return 'JSON_INT';
+
+ case JSON_STR:
+ return 'JSON_STR';
+
+ case JSON_FLOAT:
+ return 'JSON_FLOAT';
+
+ case JSON_NULL:
+ return 'JSON_NULL';
+
+ case JSON_START_OBJ:
+ return 'JSON_START_OBJ';
+
+ case JSON_END_OBJ:
+ return 'JSON_END_OBJ';
+
+ case JSON_START_ARRAY:
+ return 'JSON_START_ARRAY';
+
+ case JSON_END_ARRAY:
+ return 'JSON_END_ARRAY';
+
+ case JSON_KEY:
+ return 'JSON_KEY';
+ }
+
+ return 'UNKNOWN';
+ }
+
+ function getValue() {
+ return $this->_value;
+ }
+
+ function readToken() {
+ $chr = $this->read();
+
+ if ($chr != null) {
+ switch ($chr) {
+ case '[':
+ $this->_lastLocation[] = $this->_location;
+ $this->_location = JSON_IN_ARRAY;
+ $this->_token = JSON_START_ARRAY;
+ $this->_value = null;
+ $this->readAway();
+ return true;
+
+ case ']':
+ $this->_location = array_pop($this->_lastLocation);
+ $this->_token = JSON_END_ARRAY;
+ $this->_value = null;
+ $this->readAway();
+
+ if ($this->_location == JSON_IN_OBJECT)
+ $this->_needProp = true;
+
+ return true;
+
+ case '{':
+ $this->_lastLocation[] = $this->_location;
+ $this->_location = JSON_IN_OBJECT;
+ $this->_needProp = true;
+ $this->_token = JSON_START_OBJ;
+ $this->_value = null;
+ $this->readAway();
+ return true;
+
+ case '}':
+ $this->_location = array_pop($this->_lastLocation);
+ $this->_token = JSON_END_OBJ;
+ $this->_value = null;
+ $this->readAway();
+
+ if ($this->_location == JSON_IN_OBJECT)
+ $this->_needProp = true;
+
+ return true;
+
+ // String
+ case '"':
+ case '\'':
+ return $this->_readString($chr);
+
+ // Null
+ case 'n':
+ return $this->_readNull();
+
+ // Bool
+ case 't':
+ case 'f':
+ return $this->_readBool($chr);
+
+ default:
+ // Is number
+ if (is_numeric($chr) || $chr == '-' || $chr == '.')
+ return $this->_readNumber($chr);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function _readBool($chr) {
+ $this->_token = JSON_BOOL;
+ $this->_value = $chr == 't';
+
+ if ($chr == 't')
+ $this->skip(3); // rue
+ else
+ $this->skip(4); // alse
+
+ $this->readAway();
+
+ if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
+ $this->_needProp = true;
+
+ return true;
+ }
+
+ function _readNull() {
+ $this->_token = JSON_NULL;
+ $this->_value = null;
+
+ $this->skip(3); // ull
+ $this->readAway();
+
+ if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
+ $this->_needProp = true;
+
+ return true;
+ }
+
+ function _readString($quote) {
+ $output = "";
+ $this->_token = JSON_STR;
+ $endString = false;
+
+ while (($chr = $this->peek()) != -1) {
+ switch ($chr) {
+ case '\\':
+ // Read away slash
+ $this->read();
+
+ // Read escape code
+ $chr = $this->read();
+ switch ($chr) {
+ case 't':
+ $output .= "\t";
+ break;
+
+ case 'b':
+ $output .= "\b";
+ break;
+
+ case 'f':
+ $output .= "\f";
+ break;
+
+ case 'r':
+ $output .= "\r";
+ break;
+
+ case 'n':
+ $output .= "\n";
+ break;
+
+ case 'u':
+ $output .= $this->_int2utf8(hexdec($this->read(4)));
+ break;
+
+ default:
+ $output .= $chr;
+ break;
+ }
+
+ break;
+
+ case '\'':
+ case '"':
+ if ($chr == $quote)
+ $endString = true;
+
+ $chr = $this->read();
+ if ($chr != -1 && $chr != $quote)
+ $output .= $chr;
+
+ break;
+
+ default:
+ $output .= $this->read();
+ }
+
+ // String terminated
+ if ($endString)
+ break;
+ }
+
+ $this->readAway();
+ $this->_value = $output;
+
+ // Needed a property
+ if ($this->_needProp) {
+ $this->_token = JSON_KEY;
+ $this->_needProp = false;
+ return true;
+ }
+
+ if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
+ $this->_needProp = true;
+
+ return true;
+ }
+
+ function _int2utf8($int) {
+ $int = intval($int);
+
+ switch ($int) {
+ case 0:
+ return chr(0);
+
+ case ($int & 0x7F):
+ return chr($int);
+
+ case ($int & 0x7FF):
+ return chr(0xC0 | (($int >> 6) & 0x1F)) . chr(0x80 | ($int & 0x3F));
+
+ case ($int & 0xFFFF):
+ return chr(0xE0 | (($int >> 12) & 0x0F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr (0x80 | ($int & 0x3F));
+
+ case ($int & 0x1FFFFF):
+ return chr(0xF0 | ($int >> 18)) . chr(0x80 | (($int >> 12) & 0x3F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr(0x80 | ($int & 0x3F));
+ }
+ }
+
+ function _readNumber($start) {
+ $value = "";
+ $isFloat = false;
+
+ $this->_token = JSON_INT;
+ $value .= $start;
+
+ while (($chr = $this->peek()) != -1) {
+ if (is_numeric($chr) || $chr == '-' || $chr == '.') {
+ if ($chr == '.')
+ $isFloat = true;
+
+ $value .= $this->read();
+ } else
+ break;
+ }
+
+ $this->readAway();
+
+ if ($isFloat) {
+ $this->_token = JSON_FLOAT;
+ $this->_value = floatval($value);
+ } else
+ $this->_value = intval($value);
+
+ if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
+ $this->_needProp = true;
+
+ return true;
+ }
+
+ function readAway() {
+ while (($chr = $this->peek()) != null) {
+ if ($chr != ':' && $chr != ',' && $chr != ' ')
+ return;
+
+ $this->read();
+ }
+ }
+
+ function read($len = 1) {
+ if ($this->_pos < $this->_len) {
+ if ($len > 1) {
+ $str = substr($this->_data, $this->_pos + 1, $len);
+ $this->_pos += $len;
+
+ return $str;
+ } else
+ return $this->_data[++$this->_pos];
+ }
+
+ return null;
+ }
+
+ function skip($len) {
+ $this->_pos += $len;
+ }
+
+ function peek() {
+ if ($this->_pos < $this->_len)
+ return $this->_data[$this->_pos + 1];
+
+ return null;
+ }
+}
+
+/**
+ * This class handles JSON stuff.
+ *
+ * @package MCManager.utils
+ */
+class Moxiecode_JSON {
+ function Moxiecode_JSON() {
+ }
+
+ function decode($input) {
+ $reader = new Moxiecode_JSONReader($input);
+
+ return $this->readValue($reader);
+ }
+
+ function readValue(&$reader) {
+ $this->data = array();
+ $this->parents = array();
+ $this->cur =& $this->data;
+ $key = null;
+ $loc = JSON_IN_ARRAY;
+
+ while ($reader->readToken()) {
+ switch ($reader->getToken()) {
+ case JSON_STR:
+ case JSON_INT:
+ case JSON_BOOL:
+ case JSON_FLOAT:
+ case JSON_NULL:
+ switch ($reader->getLocation()) {
+ case JSON_IN_OBJECT:
+ $this->cur[$key] = $reader->getValue();
+ break;
+
+ case JSON_IN_ARRAY:
+ $this->cur[] = $reader->getValue();
+ break;
+
+ default:
+ return $reader->getValue();
+ }
+ break;
+
+ case JSON_KEY:
+ $key = $reader->getValue();
+ break;
+
+ case JSON_START_OBJ:
+ case JSON_START_ARRAY:
+ if ($loc == JSON_IN_OBJECT)
+ $this->addArray($key);
+ else
+ $this->addArray(null);
+
+ $cur =& $obj;
+
+ $loc = $reader->getLocation();
+ break;
+
+ case JSON_END_OBJ:
+ case JSON_END_ARRAY:
+ $loc = $reader->getLocation();
+
+ if (count($this->parents) > 0) {
+ $this->cur =& $this->parents[count($this->parents) - 1];
+ array_pop($this->parents);
+ }
+ break;
+ }
+ }
+
+ return $this->data[0];
+ }
+
+ // This method was needed since PHP is crapy and doesn't have pointers/references
+ function addArray($key) {
+ $this->parents[] =& $this->cur;
+ $ar = array();
+
+ if ($key)
+ $this->cur[$key] =& $ar;
+ else
+ $this->cur[] =& $ar;
+
+ $this->cur =& $ar;
+ }
+
+ function getDelim($index, &$reader) {
+ switch ($reader->getLocation()) {
+ case JSON_IN_ARRAY:
+ case JSON_IN_OBJECT:
+ if ($index > 0)
+ return ",";
+ break;
+ }
+
+ return "";
+ }
+
+ function encode($input) {
+ switch (gettype($input)) {
+ case 'boolean':
+ return $input ? 'true' : 'false';
+
+ case 'integer':
+ return (int) $input;
+
+ case 'float':
+ case 'double':
+ return (float) $input;
+
+ case 'NULL':
+ return 'null';
+
+ case 'string':
+ return $this->encodeString($input);
+
+ case 'array':
+ return $this->_encodeArray($input);
+
+ case 'object':
+ return $this->_encodeArray(get_object_vars($input));
+ }
+
+ return '';
+ }
+
+ function encodeString($input) {
+ // Needs to be escaped
+ if (preg_match('/[^a-zA-Z0-9]/', $input)) {
+ $output = '';
+
+ for ($i=0; $i<strlen($input); $i++) {
+ switch ($input[$i]) {
+ case "\b":
+ $output .= "\\b";
+ break;
+
+ case "\t":
+ $output .= "\\t";
+ break;
+
+ case "\f":
+ $output .= "\\f";
+ break;
+
+ case "\r":
+ $output .= "\\r";
+ break;
+
+ case "\n":
+ $output .= "\\n";
+ break;
+
+ case '\\':
+ $output .= "\\\\";
+ break;
+
+ case '\'':
+ $output .= "\\'";
+ break;
+
+ case '"':
+ $output .= '\"';
+ break;
+
+ default:
+ $byte = ord($input[$i]);
+
+ if (($byte & 0xE0) == 0xC0) {
+ $char = pack('C*', $byte, ord($input[$i + 1]));
+ $i += 1;
+ $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
+ } if (($byte & 0xF0) == 0xE0) {
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]));
+ $i += 2;
+ $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
+ } if (($byte & 0xF8) == 0xF0) {
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3])));
+ $i += 3;
+ $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
+ } if (($byte & 0xFC) == 0xF8) {
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4])));
+ $i += 4;
+ $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
+ } if (($byte & 0xFE) == 0xFC) {
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5])));
+ $i += 5;
+ $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
+ } else if ($byte < 128)
+ $output .= $input[$i];
+ }
+ }
+
+ return '"' . $output . '"';
+ }
+
+ return '"' . $input . '"';
+ }
+
+ function _utf82utf16($utf8) {
+ if (function_exists('mb_convert_encoding'))
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+
+ switch (strlen($utf8)) {
+ case 1:
+ return $utf8;
+
+ case 2:
+ return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1])));
+
+ case 3:
+ return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2])));
+ }
+
+ return '';
+ }
+
+ function _encodeArray($input) {
+ $output = '';
+ $isIndexed = true;
+
+ $keys = array_keys($input);
+ for ($i=0; $i<count($keys); $i++) {
+ if (!is_int($keys[$i])) {
+ $output .= $this->encodeString($keys[$i]) . ':' . $this->encode($input[$keys[$i]]);
+ $isIndexed = false;
+ } else
+ $output .= $this->encode($input[$keys[$i]]);
+
+ if ($i != count($keys) - 1)
+ $output .= ',';
+ }
+
+ return $isIndexed ? '[' . $output . ']' : '{' . $output . '}';
+ }
+}
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
new file mode 100644
index 0000000..a1fb4cd
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
@@ -0,0 +1,268 @@
+<?php
+/**
+ * $Id: Logger.class.php 10 2007-05-27 10:55:12Z spocke $
+ *
+ * @package MCFileManager.filesystems
+ * @author Moxiecode
+ * @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
+ */
+
+// File type contstants
+define('MC_LOGGER_DEBUG', 0);
+define('MC_LOGGER_INFO', 10);
+define('MC_LOGGER_WARN', 20);
+define('MC_LOGGER_ERROR', 30);
+define('MC_LOGGER_FATAL', 40);
+
+/**
+ * Logging utility class. This class handles basic logging with levels, log rotation and custom log formats. It's
+ * designed to be compact but still powerful and flexible.
+ */
+class Moxiecode_Logger {
+ // Private fields
+ var $_path;
+ var $_filename;
+ var $_maxSize;
+ var $_maxFiles;
+ var $_maxSizeBytes;
+ var $_level;
+ var $_format;
+
+ /**
+ * Constructs a new logger instance.
+ */
+ function Moxiecode_Logger() {
+ $this->_path = "";
+ $this->_filename = "{level}.log";
+ $this->setMaxSize("100k");
+ $this->_maxFiles = 10;
+ $this->_level = MC_LOGGER_DEBUG;
+ $this->_format = "[{time}] [{level}] {message}";
+ }
+
+ /**
+ * Sets the current log level, use the MC_LOGGER constants.
+ *
+ * @param int $level Log level instance for example MC_LOGGER_DEBUG.
+ */
+ function setLevel($level) {
+ if (is_string($level)) {
+ switch (strtolower($level)) {
+ case "debug":
+ $level = MC_LOGGER_DEBUG;
+ break;
+
+ case "info":
+ $level = MC_LOGGER_INFO;
+ break;
+
+ case "warn":
+ case "warning":
+ $level = MC_LOGGER_WARN;
+ break;
+
+ case "error":
+ $level = MC_LOGGER_ERROR;
+ break;
+
+ case "fatal":
+ $level = MC_LOGGER_FATAL;
+ break;
+
+ default:
+ $level = MC_LOGGER_FATAL;
+ }
+ }
+
+ $this->_level = $level;
+ }
+
+ /**
+ * Returns the current log level for example MC_LOGGER_DEBUG.
+ *
+ * @return int Current log level for example MC_LOGGER_DEBUG.
+ */
+ function getLevel() {
+ return $this->_level;
+ }
+
+ function setPath($path) {
+ $this->_path = $path;
+ }
+
+ function getPath() {
+ return $this->_path;
+ }
+
+ function setFileName($file_name) {
+ $this->_filename = $file_name;
+ }
+
+ function getFileName() {
+ return $this->_filename;
+ }
+
+ function setFormat($format) {
+ $this->_format = $format;
+ }
+
+ function getFormat() {
+ return $this->_format;
+ }
+
+ function setMaxSize($size) {
+ // Fix log max size
+ $logMaxSizeBytes = intval(preg_replace("/[^0-9]/", "", $size));
+
+ // Is KB
+ if (strpos((strtolower($size)), "k") > 0)
+ $logMaxSizeBytes *= 1024;
+
+ // Is MB
+ if (strpos((strtolower($size)), "m") > 0)
+ $logMaxSizeBytes *= (1024 * 1024);
+
+ $this->_maxSizeBytes = $logMaxSizeBytes;
+ $this->_maxSize = $size;
+ }
+
+ function getMaxSize() {
+ return $this->_maxSize;
+ }
+
+ function setMaxFiles($max_files) {
+ $this->_maxFiles = $max_files;
+ }
+
+ function getMaxFiles() {
+ return $this->_maxFiles;
+ }
+
+ function debug($msg) {
+ $args = func_get_args();
+ $this->_logMsg(MC_LOGGER_DEBUG, implode(', ', $args));
+ }
+
+ function info($msg) {
+ $args = func_get_args();
+ $this->_logMsg(MC_LOGGER_INFO, implode(', ', $args));
+ }
+
+ function warn($msg) {
+ $args = func_get_args();
+ $this->_logMsg(MC_LOGGER_WARN, implode(', ', $args));
+ }
+
+ function error($msg) {
+ $args = func_get_args();
+ $this->_logMsg(MC_LOGGER_ERROR, implode(', ', $args));
+ }
+
+ function fatal($msg) {
+ $args = func_get_args();
+ $this->_logMsg(MC_LOGGER_FATAL, implode(', ', $args));
+ }
+
+ function isDebugEnabled() {
+ return $this->_level >= MC_LOGGER_DEBUG;
+ }
+
+ function isInfoEnabled() {
+ return $this->_level >= MC_LOGGER_INFO;
+ }
+
+ function isWarnEnabled() {
+ return $this->_level >= MC_LOGGER_WARN;
+ }
+
+ function isErrorEnabled() {
+ return $this->_level >= MC_LOGGER_ERROR;
+ }
+
+ function isFatalEnabled() {
+ return $this->_level >= MC_LOGGER_FATAL;
+ }
+
+ function _logMsg($level, $message) {
+ $roll = false;
+
+ if ($level < $this->_level)
+ return;
+
+ $logFile = $this->toOSPath($this->_path . "/" . $this->_filename);
+
+ switch ($level) {
+ case MC_LOGGER_DEBUG:
+ $levelName = "DEBUG";
+ break;
+
+ case MC_LOGGER_INFO:
+ $levelName = "INFO";
+ break;
+
+ case MC_LOGGER_WARN:
+ $levelName = "WARN";
+ break;
+
+ case MC_LOGGER_ERROR:
+ $levelName = "ERROR";
+ break;
+
+ case MC_LOGGER_FATAL:
+ $levelName = "FATAL";
+ break;
+ }
+
+ $logFile = str_replace('{level}', strtolower($levelName), $logFile);
+
+ $text = $this->_format;
+ $text = str_replace('{time}', date("Y-m-d H:i:s"), $text);
+ $text = str_replace('{level}', strtolower($levelName), $text);
+ $text = str_replace('{message}', $message, $text);
+ $message = $text . "\r\n";
+
+ // Check filesize
+ if (file_exists($logFile)) {
+ $size = @filesize($logFile);
+
+ if ($size + strlen($message) > $this->_maxSizeBytes)
+ $roll = true;
+ }
+
+ // Roll if the size is right
+ if ($roll) {
+ for ($i=$this->_maxFiles-1; $i>=1; $i--) {
+ $rfile = $this->toOSPath($logFile . "." . $i);
+ $nfile = $this->toOSPath($logFile . "." . ($i+1));
+
+ if (@file_exists($rfile))
+ @rename($rfile, $nfile);
+ }
+
+ @rename($logFile, $this->toOSPath($logFile . ".1"));
+
+ // Delete last logfile
+ $delfile = $this->toOSPath($logFile . "." . ($this->_maxFiles + 1));
+ if (@file_exists($delfile))
+ @unlink($delfile);
+ }
+
+ // Append log line
+ if (($fp = @fopen($logFile, "a")) != null) {
+ @fputs($fp, $message);
+ @fflush($fp);
+ @fclose($fp);
+ }
+ }
+
+ /**
+ * Converts a Unix path to OS specific path.
+ *
+ * @param String $path Unix path to convert.
+ */
+ function toOSPath($path) {
+ return str_replace("/", DIRECTORY_SEPARATOR, $path);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css
deleted file mode 100755
index f2c6ac7..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css
+++ /dev/null
@@ -1,35 +0,0 @@
-.mceMsgBox {
- border: 1px solid gray;
- padding: 8px;
-}
-
-.mceMsgBox span {
- vertical-align: top;
- color: #555555;
-}
-
-/* Misc */
-
-.mceBlockBox {
- display: none;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 100;
- filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60);
- -moz-opacity:0.6;
- opacity: 0.6;
- background-color: white;
-}
-
-.mceMsgBox {
- display: none;
- z-index: 101;
- position: absolute;
- left: 0;
- top: 0;
- font-family: Arial, Verdana, Tahoma, Helvetica;
- font-weight: bold;
- font-size: 11px;
- background-color: #FFF;
-}
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif b/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif
deleted file mode 100755
index 294a9d2..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif b/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif
index 7d0a4db..7d0a4db 100755..100644
--- a/wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif
+++ b/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php b/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
new file mode 100644
index 0000000..9a12145
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * general.php
+ *
+ * @package MCManager.includes
+ * @author Moxiecode
+ * @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+@error_reporting(E_ALL ^ E_NOTICE);
+$config = array();
+
+require_once(dirname(__FILE__) . "/../classes/utils/Logger.php");
+require_once(dirname(__FILE__) . "/../classes/utils/JSON.php");
+require_once(dirname(__FILE__) . "/../config.php");
+require_once(dirname(__FILE__) . "/../classes/SpellChecker.php");
+
+if (isset($config['general.engine']))
+ require_once(dirname(__FILE__) . "/../classes/" . $config["general.engine"] . ".php");
+
+/**
+ * Returns an request value by name without magic quoting.
+ *
+ * @param String $name Name of parameter to get.
+ * @param String $default_value Default value to return if value not found.
+ * @return String request value by name without magic quoting or default value.
+ */
+function getRequestParam($name, $default_value = false, $sanitize = false) {
+ if (!isset($_REQUEST[$name]))
+ return $default_value;
+
+ if (is_array($_REQUEST[$name])) {
+ $newarray = array();
+
+ foreach ($_REQUEST[$name] as $name => $value)
+ $newarray[formatParam($name, $sanitize)] = formatParam($value, $sanitize);
+
+ return $newarray;
+ }
+
+ return formatParam($_REQUEST[$name], $sanitize);
+}
+
+function &getLogger() {
+ global $mcLogger, $man;
+
+ if (isset($man))
+ $mcLogger = $man->getLogger();
+
+ if (!$mcLogger) {
+ $mcLogger = new Moxiecode_Logger();
+
+ // Set logger options
+ $mcLogger->setPath(dirname(__FILE__) . "/../logs");
+ $mcLogger->setMaxSize("100kb");
+ $mcLogger->setMaxFiles("10");
+ $mcLogger->setFormat("{time} - {message}");
+ }
+
+ return $mcLogger;
+}
+
+function debug($msg) {
+ $args = func_get_args();
+
+ $log = getLogger();
+ $log->debug(implode(', ', $args));
+}
+
+function info($msg) {
+ $args = func_get_args();
+
+ $log = getLogger();
+ $log->info(implode(', ', $args));
+}
+
+function error($msg) {
+ $args = func_get_args();
+
+ $log = getLogger();
+ $log->error(implode(', ', $args));
+}
+
+function warn($msg) {
+ $args = func_get_args();
+
+ $log = getLogger();
+ $log->warn(implode(', ', $args));
+}
+
+function fatal($msg) {
+ $args = func_get_args();
+
+ $log = getLogger();
+ $log->fatal(implode(', ', $args));
+}
+
+?> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js b/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js
deleted file mode 100755
index 02fdac5..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('spellchecker',{
- desc : 'Toggle spellchecker',
- menu : 'Spellchecker settings',
- ignore_word : 'Ignore word',
- ignore_words : 'Ignore all',
- langs : 'Languages',
- wait : 'Please wait...',
- swait : 'Spellchecking, please wait...',
- sug : 'Suggestions',
- no_sug : 'No suggestions',
- no_mpell : 'No misspellings found.',
- mpell_found : 'Found {$words} misspellings.'
-});
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/rpc.php b/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
new file mode 100644
index 0000000..d7b7436
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * $Id: rpc.php 354 2007-11-05 20:48:49Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+require_once("./includes/general.php");
+
+// Set RPC response headers
+header('Content-Type: text/plain');
+header('Content-Encoding: UTF-8');
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+$raw = "";
+
+// Try param
+if (isset($_POST["json_data"]))
+ $raw = getRequestParam("json_data");
+
+// Try globals array
+if (!$raw && isset($_GLOBALS) && isset($_GLOBALS["HTTP_RAW_POST_DATA"]))
+ $raw = $_GLOBALS["HTTP_RAW_POST_DATA"];
+
+// Try globals variable
+if (!$raw && isset($HTTP_RAW_POST_DATA))
+ $raw = $HTTP_RAW_POST_DATA;
+
+// Try stream
+if (!$raw) {
+ if (!function_exists('file_get_contents')) {
+ $fp = fopen("php://input", "r");
+ if ($fp) {
+ $raw = "";
+
+ while (!feof($fp))
+ $raw = fread($fp, 1024);
+
+ fclose($fp);
+ }
+ } else
+ $raw = "" . file_get_contents("php://input");
+}
+
+// No input data
+if (!$raw)
+ die('{"result":null,"id":null,"error":{"errstr":"Could not get raw post data.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
+
+// Get JSON data
+$json = new Moxiecode_JSON();
+$input = $json->decode($raw);
+
+// Execute RPC
+if (isset($config['general.engine'])) {
+ $spellchecker = new $config['general.engine']($config);
+ $result = call_user_func_array(array($spellchecker, $input['method']), $input['params']);
+} else
+ die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
+
+// Request and response id should always be the same
+$output = array(
+ "id" => $input->id,
+ "result" => $result,
+ "error" => null
+);
+
+// Return JSON encoded string
+echo $json->encode($output);
+
+?> \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php
deleted file mode 100755
index 6b977c6..0000000
--- a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * $RCSfile: tinyspell.php,v $
- * $Revision: 1.1 $
- * $Date: 2006/03/14 17:33:47 $
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
- */
-
- // Ignore the Notice errors for now.
- error_reporting(E_ALL ^ E_NOTICE);
-
- require_once("config.php");
-
- $id = sanitize($_POST['id'], "loose");
-
- if (!$spellCheckerConfig['enabled']) {
- header('Content-type: text/xml; charset=utf-8');
- echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
- die;
- }
-
- // Basic config
- $defaultLanguage = $spellCheckerConfig['default.language'];
- $defaultMode = $spellCheckerConfig['default.mode'];
-
- // Normaly not required to configure
- $defaultSpelling = $spellCheckerConfig['default.spelling'];
- $defaultJargon = $spellCheckerConfig['default.jargon'];
- $defaultEncoding = $spellCheckerConfig['default.encoding'];
- $outputType = "xml"; // Do not change
-
- // Get input parameters.
-
- $check = urldecode(getRequestParam('check'));
- $cmd = sanitize(getRequestParam('cmd'));
- $lang = sanitize(getRequestParam('lang'), "strict");
- $mode = sanitize(getRequestParam('mode'), "strict");
- $spelling = sanitize(getRequestParam('spelling'), "strict");
- $jargon = sanitize(getRequestParam('jargon'), "strict");
- $encoding = sanitize(getRequestParam('encoding'), "strict");
- $sg = sanitize(getRequestParam('sg'), "bool");
- $words = array();
-
- $validRequest = true;
-
- if (empty($check))
- $validRequest = false;
-
- if (empty($lang))
- $lang = $defaultLanguage;
-
- if (empty($mode))
- $mode = $defaultMode;
-
- if (empty($spelling))
- $spelling = $defaultSpelling;
-
- if (empty($jargon))
- $jargon = $defaultJargon;
-
- if (empty($encoding))
- $encoding = $defaultEncoding;
-
- function sanitize($str, $type="strict") {
- switch ($type) {
- case "strict":
- $str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
- break;
- case "loose":
- $str = preg_replace("/</i", "&gt;", $str);
- $str = preg_replace("/>/i", "&lt;", $str);
- break;
- case "bool":
- if ($str == "true" || $str == true)
- $str = true;
- else
- $str = false;
- break;
- }
-
- return $str;
- }
-
- function getRequestParam($name, $default_value = false) {
- if (!isset($_REQUEST[$name]))
- return $default_value;
-
- if (!isset($_GLOBALS['magic_quotes_gpc']))
- $_GLOBALS['magic_quotes_gpc'] = ini_get("magic_quotes_gpc");
-
- if (isset($_GLOBALS['magic_quotes_gpc'])) {
- if (is_array($_REQUEST[$name])) {
- $newarray = array();
-
- foreach($_REQUEST[$name] as $name => $value)
- $newarray[stripslashes($name)] = stripslashes($value);
-
- return $newarray;
- }
- return stripslashes($_REQUEST[$name]);
- }
-
- return $_REQUEST[$name];
- }
-
- $result = array();
- $tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
-
- if (count($tinyspell->errorMsg) == 0) {
- switch($cmd) {
- case "spell":
- // Space for non-exec version and \n for the exec version.
- $words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
- $result = $tinyspell->checkWords($words);
- break;
-
- case "suggest":
- $result = $tinyspell->getSuggestion($check);
- break;
-
- default:
- // Just use this for now.
- $tinyspell->errorMsg[] = "No command.";
- $outputType = $outputType . "error";
- break;
- }
- } else
- $outputType = $outputType . "error";
-
- if (!$result)
- $result = array();
-
- // Output data
- switch($outputType) {
- case "xml":
- header('Content-type: text/xml; charset=utf-8');
- $body = '<?xml version="1.0" encoding="utf-8" ?>';
- $body .= "\n";
-
- if (count($result) == 0)
- $body .= '<res id="' . $id . '" cmd="'. $cmd .'" />';
- else
- $body .= '<res id="' . $id . '" cmd="'. $cmd .'">'. urlencode(implode(" ", $result)) .'</res>';
-
- echo $body;
- break;
- case "xmlerror";
- header('Content-type: text/xml; charset=utf-8');
- $body = '<?xml version="1.0" encoding="utf-8" ?>';
- $body .= "\n";
- $body .= '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
- echo $body;
- break;
- case "html":
- var_dump($result);
- break;
- case "htmlerror":
- echo "Error";
- break;
- }
-
-?>
diff --git a/wp-includes/js/tinymce/plugins/wordpress/css/content.css b/wp-includes/js/tinymce/plugins/wordpress/css/content.css
new file mode 100644
index 0000000..a542e6e
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wordpress/css/content.css
@@ -0,0 +1,15 @@
+
+.mceWPnextpage, .mceWPmore {
+ border: 0px;
+ border-top: 1px dotted #cccccc;
+ display: block;
+ width: 100%;
+ height: 12px;
+ margin-top: 15px;
+}
+.mceWPmore {
+ background: #ffffff url(../img/more_bug.gif) no-repeat right top;
+}
+.mceWPnextpage {
+ background: #ffffff url(../img/page_bug.gif) no-repeat right top;
+} \ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/help.gif b/wp-includes/js/tinymce/plugins/wordpress/img/help.gif
index 51a1ee4..51a1ee4 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/images/help.gif
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/help.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/more.gif b/wp-includes/js/tinymce/plugins/wordpress/img/more.gif
index 4ff564d..4ff564d 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/images/more.gif
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/more.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif b/wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif
index 4589cb4..4589cb4 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/page.gif b/wp-includes/js/tinymce/plugins/wordpress/img/page.gif
index 1cea78a..1cea78a 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/images/page.gif
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/page.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif b/wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif
index 9ea3565..9ea3565 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/toolbars.gif b/wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif
index dcb7066..dcb7066 100755..100644
--- a/wp-includes/js/tinymce/plugins/wordpress/images/toolbars.gif
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif b/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif
new file mode 100644
index 0000000..3884865
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/langs/en.js b/wp-includes/js/tinymce/plugins/wordpress/langs/en.js
deleted file mode 100644
index b431fb6..0000000
--- a/wp-includes/js/tinymce/plugins/wordpress/langs/en.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// EN lang variables
-
-if (navigator.userAgent.indexOf('Mac OS') != -1) {
-// Mac OS browsers use Ctrl to hit accesskeys
- var metaKey = 'Ctrl';
-}
-else if (navigator.userAgent.indexOf('Firefox/2') != -1) {
-// Firefox 2.x uses Alt+Shift to hit accesskeys
- var metaKey = 'Alt+Shift';
-}
-else {
- var metaKey = 'Alt';
-}
-
-tinyMCE.addToLang('',{
-wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
-wordpress_page_button : 'Split post with Page tag',
-wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+v)',
-wordpress_more_alt : 'More...',
-wordpress_page_alt : '...page...',
-help_button_title : 'Help (' + metaKey + '+h)',
-bold_desc : 'Bold (Ctrl+B)',
-italic_desc : 'Italic (Ctrl+I)',
-underline_desc : 'Underline (Ctrl+U)',
-link_desc : 'Insert/edit link (' + metaKey + '+a)',
-unlink_desc : 'Unlink (' + metaKey + '+s)',
-image_desc : 'Insert/edit image (' + metaKey + '+m)',
-striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
-justifyleft_desc : 'Align left (' + metaKey + '+f)',
-justifycenter_desc : 'Align center (' + metaKey + '+c)',
-justifyright_desc : 'Align right (' + metaKey + '+r)',
-justifyfull_desc : 'Align full (' + metaKey + '+j)',
-bullist_desc : 'Unordered list (' + metaKey + '+l)',
-numlist_desc : 'Ordered list (' + metaKey + '+o)',
-outdent_desc : 'Outdent (' + metaKey + '+w)',
-indent_desc : 'Indent list/blockquote (' + metaKey + '+q)'
-});
diff --git a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css
deleted file mode 100644
index 00b454f..0000000
--- a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css
+++ /dev/null
@@ -1,81 +0,0 @@
-.mce_plugin_wordpress_more {
- border: 0px;
- border-top: 1px dotted #cccccc;
- display:block;
- background-color: #ffffff;
- margin-top:15px;
- background-image: url(images/more_bug.gif);
- background-repeat: no-repeat;
- background-position: right top;
-}
-
-.mce_plugin_wordpress_page {
- border: 0px;
- border-top: 1px dotted #cccccc;
- display:block;
- background-color: #ffffff;
- margin-top:15px;
- background-image: url(images/page_bug.gif);
- background-repeat: no-repeat;
- background-position: right top;
-}
-
-/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
-/* You can extend this CSS by adding your own CSS file with the the content_css option */
-
-body {
- background: #fff;
- font: 1em/1.3em Georgia, "Times New Roman", Times, serif;
- padding: .5em;
-}
-
-td {
- font-size: 10px;
-}
-
-pre {
- font-family: "Courier New", fixed;
- font-size: 11px;
- line-height: 13px;
-}
-
-.mceVisualAid {
- border: 1px dashed #BBBBBB !important;
-}
-
-.mceItemAnchor {
- width: 12px;
- line-height: 6px;
- overflow: hidden;
- padding-left: 12px;
- background-position: bottom;
- background-repeat: no-repeat;
-}
-
-/* Important is needed in Gecko browsers inorder to style links */
-/*
-a {
- color: green !important;
-}
-*/
-
-/* Style selection range colors in Gecko browsers */
-/*
-::-moz-selection {
- background-color: red;
- color: green;
-}
-*/
-
-/* MSIE specific */
-
-* html body {
- scrollbar-3dlight-color: #F0F0EE;
- scrollbar-arrow-color: #676662;
- scrollbar-base-color: #F0F0EE;
- scrollbar-darkshadow-color: #DDDDDD;
- scrollbar-face-color: #E0E0DD;
- scrollbar-highlight-color: #F0F0EE;
- scrollbar-shadow-color: #F0F0EE;
- scrollbar-track-color: #F5F5F5;
-}
diff --git a/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js b/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js
deleted file mode 100644
index 204e447..0000000
--- a/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('wphelp', '');
-
-function TinyMCE_wphelp_getControlHTML(control_name) {
- switch (control_name) {
- case "wphelp":
- var titleHelp = tinyMCE.getLang('lang_help_button_title');
- var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\');return false;"><img id="{$editor_id}_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
- var hiddenControls = '<div class="zerosize">'
- + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
- + '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
- + '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
- + '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
- + '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
- + '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
- + '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
- + '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
- + '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
- + '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
- + '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
- + '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
- + '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
- + '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" />'
- + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
- + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
- + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
- + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\',false);" />'
- + '</div>';
- return buttons+hiddenControls;
- }
-
- return "";
-}
-
-function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) {
-
- // Handle commands
- switch (command) {
- case "mceWordPressHelp":
- var template = new Array();
-
- template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
- template['width'] = 480;
- template['height'] = 380;
-
- args = {
- resizable : 'yes',
- scrollbars : 'yes'
- };
-
- tinyMCE.openWindow(template, args);
- return true;
- }
-
- // Pass to next handler in chain
- return false;
-}
diff --git a/wp-includes/js/tinymce/plugins/wphelp/images/help.gif b/wp-includes/js/tinymce/plugins/wphelp/images/help.gif
deleted file mode 100644
index 51a1ee4..0000000
--- a/wp-includes/js/tinymce/plugins/wphelp/images/help.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/plugins/wphelp/langs/en.js b/wp-includes/js/tinymce/plugins/wphelp/langs/en.js
deleted file mode 100644
index b7b2aba..0000000
--- a/wp-includes/js/tinymce/plugins/wphelp/langs/en.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// EN lang variables
-
-tinyMCE.addToLang('',{
-help_button_title : 'Help (Alt+h)'
-});
diff --git a/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css b/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css
deleted file mode 100644
index 4b0360b..0000000
--- a/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Colorpicker dialog specific CSS */
-
-#preview {
- float: right;
- width: 50px;
- height: 14px;
- line-height: 1px;
- border: 1px solid black;
- margin-left: 5px;
-}
-
-#colorpicker {
- float: left;
- cursor: crosshair;
-}
-
-#light {
- border: 1px solid gray;
- margin-left: 5px;
- float: left;
- width: 15px;
- cursor: crosshair;
-}
-
-#light div {
- overflow: hidden;
-}
-
-#previewblock {
- float: right;
- padding-left: 10px;
- height: 20px;
-}
-
-.panel_wrapper div.current {
- height: 175px;
-}
-
-#namedcolors {
- width: 150px;
-}
-
-#namedcolors a {
- display: block;
- float: left;
- width: 10px; height: 10px;
- margin: 1px 1px 0 0;
- overflow: hidden;
-}
-
-#colornamecontainer {
- margin-top: 5px;
-} \ No newline at end of file
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
deleted file mode 100644
index 182e791..0000000
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
-/* You can extend this CSS by adding your own CSS file with the the content_css option */
-
-body, td, pre {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10px;
-}
-
-body {
- background-color: #FFFFFF;
-}
-
-.mceVisualAid {
- border: 1px dashed #BBBBBB !important;
-}
-
-div.mceVisualAid {
- background-image:url('../images/spacer.gif');
- visibility: visible !important;
-}
-
-.mceItemAnchor {
- width: 12px;
- line-height: 6px;
- overflow: hidden;
- padding-left: 12px;
- background-image: url('../images/anchor_symbol.gif');
- background-position: bottom;
- background-repeat: no-repeat;
-}
-
-/* Important is needed in Gecko browsers inorder to style links */
-/*
-a {
- color: green !important;
-}
-*/
-
-/* Style selection range colors in Gecko browsers */
-/*
-::-moz-selection {
- background-color: red;
- color: green;
-}
-*/
-
-/* MSIE specific */
-
-* html body {
- scrollbar-3dlight-color: #F0F0EE;
- scrollbar-arrow-color: #676662;
- scrollbar-base-color: #F0F0EE;
- scrollbar-darkshadow-color: #DDDDDD;
- scrollbar-face-color: #E0E0DD;
- scrollbar-highlight-color: #F0F0EE;
- scrollbar-shadow-color: #F0F0EE;
- scrollbar-track-color: #F5F5F5;
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
deleted file mode 100644
index 079470c..0000000
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
+++ /dev/null
@@ -1,358 +0,0 @@
-/* This file contains the CSS data for all popups in TinyMCE */
-
-body {
- background-color: #F0F0EE;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 11px;
- scrollbar-3dlight-color: #F0F0EE;
- scrollbar-arrow-color: #676662;
- scrollbar-base-color: #F0F0EE;
- scrollbar-darkshadow-color: #DDDDDD;
- scrollbar-face-color: #E0E0DD;
- scrollbar-highlight-color: #F0F0EE;
- scrollbar-shadow-color: #F0F0EE;
- scrollbar-track-color: #F5F5F5;
- margin: 8px;
-}
-
-td {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 11px;
-}
-
-input {
- background: #FFFFFF;
- border: 1px solid #cccccc;
-}
-
-td, input, select, textarea {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10px;
-}
-
-input, select, textarea {
- border: 1px solid #808080;
-}
-
-.input_noborder {
- border: 0;
-}
-
-#insert, .updateButton {
- font-weight: bold;
- width: 90px;
- height: 21px;
- border: 0;
- background-image: url('../images/insert_button_bg.gif');
- cursor: pointer;
-}
-
-#cancel {
- font-weight: bold;
- width: 90px;
- height: 21px;
- border: 0;
- background-image: url('../images/cancel_button_bg.gif');
- cursor: pointer;
-}
-
-/* Mozilla only style */
-html>body #insert, html>body #cancel {
- padding-bottom: 2px;
-}
-
-.title {
- font-size: 12px;
- font-weight: bold;
- color: #2B6FB6;
-}
-
-table.charmap {
- border-style: solid;
- border-width: 1px;
- border-color: #AAAAAA;
-}
-
-td.charmap, td.charmapOver {
- color: #000000;
- border-color: #AAAAAA;
- border-style: solid;
- border-width: 1px;
- text-align: center;
- font-size: 12px;
-}
-
-td.charmapOver {
- background-color: #CCCCCC;
- cursor: default;
-}
-
-a.charmap {
- color: #000000;
- text-decoration: none
-}
-
-.wordWrapCode {
- vertical-align: middle;
- border: 1px none #000000;
- background-color: transparent;
-}
-
-input.radio {
- border: 1px none #000000;
- background-color: transparent;
- vertical-align: middle;
-}
-
-input.checkbox {
- border: 1px none #000000;
- background-color: transparent;
- vertical-align: middle;
-}
-
-.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected {
- margin-left: 1px;
-}
-
-.mceButtonNormal {
- border-top: 1px solid;
- border-left: 1px solid;
- border-bottom: 1px solid;
- border-right: 1px solid;
- border-color: #F0F0EE;
- cursor: default;
-}
-
-.mceButtonOver {
- border: 1px solid #0A246A;
- cursor: default;
- background-color: #B6BDD2;
-}
-
-.mceButtonDown {
- cursor: default;
- border: 1px solid #0A246A;
- background-color: #8592B5;
-}
-
-.mceButtonDisabled {
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
- -moz-opacity:0.3;
- opacity: 0.3;
- border-top: 1px solid;
- border-left: 1px solid;
- border-bottom: 1px solid;
- border-right: 1px solid;
- border-color: #F0F0EE;
- cursor: default;
-}
-
-.mceActionPanel {
- margin-top: 5px;
-}
-
-/* Tabs classes */
-
-.tabs {
- float: left;
- width: 100%;
- line-height: normal;
- background-image: url("../images/xp/tabs_bg.gif");
-}
-
-.tabs ul {
- margin: 0;
- padding: 0 0 0;
- list-style: none;
-}
-
-.tabs li {
- float: left;
- background: url("../images/xp/tab_bg.gif") no-repeat left top;
- margin: 0;
- margin-left: 0;
- margin-right: 2px;
- padding: 0 0 0 10px;
- line-height: 18px;
-}
-
-.tabs li.current {
- background: url("../images/xp/tab_sel_bg.gif") no-repeat left top;
- margin-right: 2px;
-}
-
-.tabs span {
- float: left;
- display: block;
- background: url("../images/xp/tab_end.gif") no-repeat right top;
- padding: 0px 10px 0 0;
-}
-
-.tabs .current span {
- background: url("../images/xp/tab_sel_end.gif") no-repeat right top;
-}
-
-.tabs a {
- text-decoration: none;
- font-family: Verdana, Arial;
- font-size: 10px;
-}
-
-.tabs a:link, .tabs a:visited, .tabs a:hover {
- color: black;
-}
-
-.tabs a:hover {
-}
-
-.tabs .current {
-}
-
-.tabs .current a, .tabs .current a:link, .tabs .current a:visited {
-}
-
-.panel_wrapper div.panel {
- display: none;
-}
-
-.panel_wrapper div.current {
- display: block;
- width: 100%;
- height: 300px;
- overflow: visible; /* Should be auto but that breaks Safari */
-}
-
-.panel_wrapper {
- border: 1px solid #919B9C;
- border-top: 0px;
- padding: 10px;
- padding-top: 5px;
- clear: both;
- background-color: white;
-}
-
-fieldset {
- border: 1px solid #919B9C;
- font-family: Verdana, Arial;
- font-size: 10px;
- padding: 0;
- margin: 0;
- padding: 4px;
-}
-
-legend {
- color: #2B6FB6;
- font-weight: bold;
-}
-
-.properties {
- width: 100%;
-}
-
-.properties .column1 {
-}
-
-.properties .column2 {
- text-align: left;
-}
-
-a:link, a:visited {
- color: black;
-}
-
-a:hover {
- color: #2B6FB6;
-}
-
-#plugintable thead {
- font-weight: bold;
- background-color: #DDDDDD;
-}
-
-#plugintable, #about #plugintable td {
- border: 1px solid #919B9C;
-}
-
-#plugintable {
- width: 99%;
- margin-top: 10px;
-}
-
-#pluginscontainer {
- height: 290px;
- overflow: auto;
-}
-
-/* MSIE Specific styles */
-
-* html .panel_wrapper {
- width: 100%;
-}
-
-.column {
- float: left;
-}
-
-h1, h2, h3, h4 {
- color: #2B6FB6;
- margin: 0;
- padding: 0;
- padding-top: 5px;
-}
-
-h3 {
- font-size: 14px;
-}
-
-#link .panel_wrapper, #link div.current {
- height: 125px;
-}
-
-#image .panel_wrapper, #image div.current {
- height: 190px;
-}
-
-label.msg { display: none; }
-label.invalid { color: #EE0000; display: inline; }
-input.invalid { border: 1px solid #EE0000; }
-
-/* Disables the advanced tab in the table plugin. */
-/*
-#table #advanced_tab {
- display: none;
-}
-*/
-
-/* Disables the border input field and label in the table plugin. */
-/*
-#table #border, #table #borderlabel {
- display: none;
-}
-*/
-
-/* Below this line is WordPress customizations */
-#insert, #cancel, .submitbutton {
- font: 11px Verdana, Arial, Helvetica, sans-serif;
- height: auto;
- width: auto;
- background-color: transparent;
- background-image: url(../../../../../../wp-admin/images/fade-butt.png);
- background-repeat: repeat;
- border: 3px double;
- border-right-color: rgb(153, 153, 153);
- border-bottom-color: rgb(153, 153, 153);
- border-left-color: rgb(204, 204, 204);
- border-top-color: rgb(204, 204, 204);
- color: rgb(51, 51, 51);
- padding: 0.1em 0.5em;
-}
-
-#insert:active, #cancel:active, .submitbutton:active {
- background: #f4f4f4;
- border-left-color: #999;
- border-top-color: #999;
-}
-
-#styleSelectRow {
- display: none;
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
deleted file mode 100644
index 851837d..0000000
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
+++ /dev/null
@@ -1,97 +0,0 @@
-/* This file contains the CSS data for the editor UI of TinyMCE instances */
-
-.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;}
-.mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;}
-.mceSelectList {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 7pt !important; font-weight: normal; margin-top: 3px; padding: 0; display: inline; vertical-align: top; background-color: #F0F0EE;}
-.mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;}
-.mceLabel {color: #000000;}
-.mceLabelDisabled {cursor: text; color: #999999;}
-.mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;}
-.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; }
-.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;}
-.mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;}
-.mceToolbarBottom {border-top: 1px solid #cccccc;}
-.mceToolbarContainer {display: block; position: relative; left: 0; top: 0; width: 100%;}
-.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;}
-.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;}
-.mceStatusbarTop {border-bottom: 1px solid #cccccc;}
-.mceStatusbarBottom {border-top: 1px solid #cccccc;}
-.mceStatusbar {border-bottom: 1px solid #cccccc;}
-.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;}
-.mcePathItem:hover {text-decoration: underline;}
-.mceStatusbarPathText {float: left;}
-.mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;}
-.mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;}
-.mceEditorIframe {border: 0;}
-
-/* Button CSS rules */
-
-a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;}
-a.mceButtonDisabled img {border: 0 !important;}
-a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;}
-a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
-a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;}
-a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;}
-a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;}
-
-/* Menu button CSS rules */
-
-span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;}
-span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;}
-span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;}
-span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;}
-span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
-span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;}
-span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;}
-span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;}
-span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
-span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;}
-
-/* Menu */
-
-.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 1000; background-color: white; border: 1px solid gray; font-weight: normal;}
-.mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;}
-.mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;}
-.mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;}
-.mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;}
-.mceMenuTitle span {padding-left: 5px;}
-.mceMenuTitle {background-color: #DDDDDD; font-weight: bold;}
-.mceMenuDisabled {color: gray;}
-span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;}
-span.mceMenuCheckItem {padding-left: 20px;}
-span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;}
-.mceColors table, .mceColors td {margin: 0; padding: 2px;}
-a.mceMoreColors {width: auto; padding: 0; margin: 0 3px 3px 3px; text-align: center; border: 1px solid white; text-decoration: none !important;}
-.mceColorPreview {position: absolute; overflow:hidden; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;}
-a.mceMoreColors:hover {border: 1px solid #0A246A;}
-.mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;}
-
-/* MSIE 6 specific rules */
-
-* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
-* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
-* html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
-* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
-* html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
-* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
-* html .mceSelectList {margin-top: 2px;}
-* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
-* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;}
-* html a.mceMoreColors {width: auto;}
-* html .mceColors td a {width: 10px; height: 10px;}
-* html .mceColorPreview {margin-left: 2px; margin-top: 14px;}
-
-/* MSIE 7 specific rules */
-
-*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
-*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
-*:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
-*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
-*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
-*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
-*:first-child+html .mceSelectList {margin-top: 2px;}
-*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
-*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;}
-*:first-child+html a.mceMoreColors {width: 137px;}
-*:first-child+html .mceColors td a {width: 10px; height: 10px;}
-*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;}
diff --git a/wp-includes/js/tinymce/themes/advanced/images/anchor.gif b/wp-includes/js/tinymce/themes/advanced/images/anchor.gif
deleted file mode 100644
index 34ab715..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/anchor.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif b/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif
deleted file mode 100644
index d03e206..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bold.gif b/wp-includes/js/tinymce/themes/advanced/images/bold.gif
deleted file mode 100644
index d6a9cc2..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bold.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bold_de_se.gif b/wp-includes/js/tinymce/themes/advanced/images/bold_de_se.gif
deleted file mode 100644
index 9b129de..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bold_de_se.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bold_es.gif b/wp-includes/js/tinymce/themes/advanced/images/bold_es.gif
deleted file mode 100644
index ea341e6..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bold_es.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bold_fr.gif b/wp-includes/js/tinymce/themes/advanced/images/bold_fr.gif
deleted file mode 100644
index 2816454..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bold_fr.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bold_ru.gif b/wp-includes/js/tinymce/themes/advanced/images/bold_ru.gif
deleted file mode 100644
index e000d46..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bold_ru.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bold_tw.gif b/wp-includes/js/tinymce/themes/advanced/images/bold_tw.gif
deleted file mode 100644
index 8208543..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bold_tw.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/browse.gif b/wp-includes/js/tinymce/themes/advanced/images/browse.gif
deleted file mode 100644
index c786d0b..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/browse.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/bullist.gif b/wp-includes/js/tinymce/themes/advanced/images/bullist.gif
deleted file mode 100644
index 6e19467..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/bullist.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/button_menu.gif b/wp-includes/js/tinymce/themes/advanced/images/button_menu.gif
deleted file mode 100644
index c3d8fa2..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/button_menu.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/buttons.gif b/wp-includes/js/tinymce/themes/advanced/images/buttons.gif
deleted file mode 100644
index 5ad99a7..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/buttons.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/cancel_button_bg.gif b/wp-includes/js/tinymce/themes/advanced/images/cancel_button_bg.gif
deleted file mode 100644
index 4b4aeef..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/cancel_button_bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/center.gif b/wp-includes/js/tinymce/themes/advanced/images/center.gif
deleted file mode 100644
index 42d609a..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/center.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/charmap.gif b/wp-includes/js/tinymce/themes/advanced/images/charmap.gif
deleted file mode 100644
index 3cdc4ac..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/charmap.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/cleanup.gif b/wp-includes/js/tinymce/themes/advanced/images/cleanup.gif
deleted file mode 100644
index 16491f6..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/cleanup.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/close.gif b/wp-includes/js/tinymce/themes/advanced/images/close.gif
deleted file mode 100644
index 679ca2a..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/close.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/code.gif b/wp-includes/js/tinymce/themes/advanced/images/code.gif
deleted file mode 100644
index c5d5a67..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/code.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/color.gif b/wp-includes/js/tinymce/themes/advanced/images/color.gif
deleted file mode 100644
index 1ecd574..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/color.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/copy.gif b/wp-includes/js/tinymce/themes/advanced/images/copy.gif
deleted file mode 100644
index dc14686..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/copy.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/custom_1.gif b/wp-includes/js/tinymce/themes/advanced/images/custom_1.gif
deleted file mode 100644
index 4cbccda..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/custom_1.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/cut.gif b/wp-includes/js/tinymce/themes/advanced/images/cut.gif
deleted file mode 100644
index 4e9a70b..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/cut.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif b/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif
deleted file mode 100644
index 8b70361..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/full.gif b/wp-includes/js/tinymce/themes/advanced/images/full.gif
deleted file mode 100644
index c8504f6..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/full.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/help.gif b/wp-includes/js/tinymce/themes/advanced/images/help.gif
deleted file mode 100644
index 51a1ee4..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/help.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/hr.gif b/wp-includes/js/tinymce/themes/advanced/images/hr.gif
deleted file mode 100644
index 1a1ba2a..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/hr.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/image.gif b/wp-includes/js/tinymce/themes/advanced/images/image.gif
deleted file mode 100644
index 4b88edd..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/image.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/indent.gif b/wp-includes/js/tinymce/themes/advanced/images/indent.gif
deleted file mode 100644
index acd315b..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/indent.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/insert_button_bg.gif b/wp-includes/js/tinymce/themes/advanced/images/insert_button_bg.gif
deleted file mode 100644
index 69c131c..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/insert_button_bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/italic.gif b/wp-includes/js/tinymce/themes/advanced/images/italic.gif
deleted file mode 100644
index 8bb330b..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/italic.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/italic_de_se.gif b/wp-includes/js/tinymce/themes/advanced/images/italic_de_se.gif
deleted file mode 100644
index feb0309..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/italic_de_se.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/italic_es.gif b/wp-includes/js/tinymce/themes/advanced/images/italic_es.gif
deleted file mode 100644
index 4572cdb..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/italic_es.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/italic_ru.gif b/wp-includes/js/tinymce/themes/advanced/images/italic_ru.gif
deleted file mode 100644
index a2bb69a..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/italic_ru.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/italic_tw.gif b/wp-includes/js/tinymce/themes/advanced/images/italic_tw.gif
deleted file mode 100644
index 4f6eeaa..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/italic_tw.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/justifycenter.gif b/wp-includes/js/tinymce/themes/advanced/images/justifycenter.gif
deleted file mode 100644
index 42d609a..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/justifycenter.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/justifyfull.gif b/wp-includes/js/tinymce/themes/advanced/images/justifyfull.gif
deleted file mode 100644
index c8504f6..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/justifyfull.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/justifyleft.gif b/wp-includes/js/tinymce/themes/advanced/images/justifyleft.gif
deleted file mode 100644
index e8f7e42..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/justifyleft.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/justifyright.gif b/wp-includes/js/tinymce/themes/advanced/images/justifyright.gif
deleted file mode 100644
index e4cea97..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/justifyright.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/left.gif b/wp-includes/js/tinymce/themes/advanced/images/left.gif
deleted file mode 100644
index e8f7e42..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/left.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/link.gif b/wp-includes/js/tinymce/themes/advanced/images/link.gif
deleted file mode 100644
index 1accf42..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/link.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/menu_check.gif b/wp-includes/js/tinymce/themes/advanced/images/menu_check.gif
deleted file mode 100644
index 50d6afd..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/menu_check.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/newdocument.gif b/wp-includes/js/tinymce/themes/advanced/images/newdocument.gif
deleted file mode 100644
index a9d2938..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/newdocument.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/numlist.gif b/wp-includes/js/tinymce/themes/advanced/images/numlist.gif
deleted file mode 100644
index a268352..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/numlist.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/opacity.png b/wp-includes/js/tinymce/themes/advanced/images/opacity.png
deleted file mode 100644
index b4217cb..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/opacity.png
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/outdent.gif b/wp-includes/js/tinymce/themes/advanced/images/outdent.gif
deleted file mode 100644
index 23f6aa4..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/outdent.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/paste.gif b/wp-includes/js/tinymce/themes/advanced/images/paste.gif
deleted file mode 100644
index 1b45000..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/paste.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/redo.gif b/wp-includes/js/tinymce/themes/advanced/images/redo.gif
deleted file mode 100644
index 3af9069..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/redo.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/removeformat.gif b/wp-includes/js/tinymce/themes/advanced/images/removeformat.gif
deleted file mode 100644
index 0fa3cb7..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/removeformat.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/right.gif b/wp-includes/js/tinymce/themes/advanced/images/right.gif
deleted file mode 100644
index e4cea97..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/right.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/statusbar_resize.gif b/wp-includes/js/tinymce/themes/advanced/images/statusbar_resize.gif
deleted file mode 100644
index af89d80..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/statusbar_resize.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/strikethrough.gif b/wp-includes/js/tinymce/themes/advanced/images/strikethrough.gif
deleted file mode 100644
index 3264635..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/strikethrough.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/sub.gif b/wp-includes/js/tinymce/themes/advanced/images/sub.gif
deleted file mode 100644
index 4d7ce30..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/sub.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/sup.gif b/wp-includes/js/tinymce/themes/advanced/images/sup.gif
deleted file mode 100644
index a7145e0..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/sup.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table.gif b/wp-includes/js/tinymce/themes/advanced/images/table.gif
deleted file mode 100644
index 2911830..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table_delete_col.gif b/wp-includes/js/tinymce/themes/advanced/images/table_delete_col.gif
deleted file mode 100644
index 91f53af..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table_delete_col.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table_delete_row.gif b/wp-includes/js/tinymce/themes/advanced/images/table_delete_row.gif
deleted file mode 100644
index 7025733..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table_delete_row.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table_insert_col_after.gif b/wp-includes/js/tinymce/themes/advanced/images/table_insert_col_after.gif
deleted file mode 100644
index 8505808..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table_insert_col_after.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table_insert_col_before.gif b/wp-includes/js/tinymce/themes/advanced/images/table_insert_col_before.gif
deleted file mode 100644
index b669d4f..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table_insert_col_before.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table_insert_row_after.gif b/wp-includes/js/tinymce/themes/advanced/images/table_insert_row_after.gif
deleted file mode 100644
index b9c1446..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table_insert_row_after.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/table_insert_row_before.gif b/wp-includes/js/tinymce/themes/advanced/images/table_insert_row_before.gif
deleted file mode 100644
index 157d373..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/table_insert_row_before.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/underline.gif b/wp-includes/js/tinymce/themes/advanced/images/underline.gif
deleted file mode 100644
index 1dfeb5f..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/underline.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/underline_es.gif b/wp-includes/js/tinymce/themes/advanced/images/underline_es.gif
deleted file mode 100644
index 551d914..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/underline_es.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/underline_fr.gif b/wp-includes/js/tinymce/themes/advanced/images/underline_fr.gif
deleted file mode 100644
index 551d914..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/underline_fr.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/underline_ru.gif b/wp-includes/js/tinymce/themes/advanced/images/underline_ru.gif
deleted file mode 100644
index b78e2a4..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/underline_ru.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/underline_tw.gif b/wp-includes/js/tinymce/themes/advanced/images/underline_tw.gif
deleted file mode 100644
index b715390..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/underline_tw.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/undo.gif b/wp-includes/js/tinymce/themes/advanced/images/undo.gif
deleted file mode 100644
index 520796d..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/undo.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/unlink.gif b/wp-includes/js/tinymce/themes/advanced/images/unlink.gif
deleted file mode 100644
index 5c8a33d..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/unlink.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/visualaid.gif b/wp-includes/js/tinymce/themes/advanced/images/visualaid.gif
deleted file mode 100644
index 63caf18..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/visualaid.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_bg.gif b/wp-includes/js/tinymce/themes/advanced/images/xp/tab_bg.gif
deleted file mode 100644
index 897a01f..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_end.gif b/wp-includes/js/tinymce/themes/advanced/images/xp/tab_end.gif
deleted file mode 100644
index aee442b..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_end.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_bg.gif b/wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_bg.gif
deleted file mode 100644
index 9dc8abe..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_end.gif b/wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_end.gif
deleted file mode 100644
index 616a889..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_end.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/xp/tabs_bg.gif b/wp-includes/js/tinymce/themes/advanced/images/xp/tabs_bg.gif
deleted file mode 100644
index c303f66..0000000
--- a/wp-includes/js/tinymce/themes/advanced/images/xp/tabs_bg.gif
+++ /dev/null
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/colors.jpg b/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg
index b4c542d..b4c542d 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/colors.jpg
+++ b/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/img/fm.gif b/wp-includes/js/tinymce/themes/advanced/img/fm.gif
new file mode 100644
index 0000000..b5f022b
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/img/fm.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png b/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png
new file mode 100644
index 0000000..8a396e0
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/img/icons.gif b/wp-includes/js/tinymce/themes/advanced/img/icons.gif
new file mode 100644
index 0000000..6870827
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/img/icons.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/img/sflogo.png b/wp-includes/js/tinymce/themes/advanced/img/sflogo.png
new file mode 100644
index 0000000..142a6f9
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/img/sflogo.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/js/about.js b/wp-includes/js/tinymce/themes/advanced/js/about.js
new file mode 100644
index 0000000..277550f
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/js/about.js
@@ -0,0 +1,72 @@
+tinyMCEPopup.requireLangPack();
+
+function init() {
+ var ed, tcont;
+
+ tinyMCEPopup.resizeToInnerSize();
+ ed = tinyMCEPopup.editor;
+
+ // Give FF some time
+ window.setTimeout('insertHelpIFrame();', 10);
+
+ tcont = document.getElementById('plugintablecontainer');
+ document.getElementById('plugins_tab').style.display = 'none';
+
+ var html = "";
+ html += '<table id="plugintable">';
+ html += '<thead>';
+ html += '<tr>';
+ html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>';
+ html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>';
+ html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>';
+ html += '</tr>';
+ html += '</thead>';
+ html += '<tbody>';
+
+ tinymce.each(ed.plugins, function(p, n) {
+ var info;
+
+ if (!p.getInfo)
+ return;
+
+ html += '<tr>';
+
+ info = p.getInfo();
+
+ if (info.infourl != null && info.infourl != '')
+ html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
+ else
+ html += '<td width="50%" title="' + n + '">' + info.longname + '</td>';
+
+ if (info.authorurl != null && info.authorurl != '')
+ html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
+ else
+ html += '<td width="35%">' + info.author + '</td>';
+
+ html += '<td width="15%">' + info.version + '</td>';
+ html += '</tr>';
+
+ document.getElementById('plugins_tab').style.display = '';
+
+ });
+
+ html += '</tbody>';
+ html += '</table>';
+
+ tcont.innerHTML = html;
+
+ tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
+ tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate;
+}
+
+function insertHelpIFrame() {
+ var html;
+
+ if (tinyMCEPopup.getParam('docs_url')) {
+ html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';
+ document.getElementById('iframecontainer').innerHTML = html;
+ document.getElementById('help_tab').style.display = 'block';
+ }
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/wp-includes/js/tinymce/themes/advanced/js/anchor.js b/wp-includes/js/tinymce/themes/advanced/js/anchor.js
new file mode 100644
index 0000000..f1d01ea
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/js/anchor.js
@@ -0,0 +1,33 @@
+tinyMCEPopup.requireLangPack();
+
+var AnchorDialog = {
+ init : function(ed) {
+ var action, elm, f = document.forms[0];
+
+ this.editor = ed;
+ elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
+ v = ed.dom.getAttrib(elm, 'name');
+
+ if (v)
+ f.anchorName.value = v;
+
+ f.insert.value = ed.getLang(elm ? 'update' : 'insert');
+ },
+
+ update : function() {
+ var ed = this.editor;
+
+ tinyMCEPopup.restoreSelection();
+ ed.selection.collapse(1);
+
+ // Webkit acts weird if empty inline element is inserted so we need to use a image instead
+ if (tinymce.isWebKit)
+ ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
+ else
+ ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
+
+ tinyMCEPopup.close();
+ }
+};
+
+tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js b/wp-includes/js/tinymce/themes/advanced/js/charmap.js
index c4ec326..d9fd8d3 100644
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js
+++ b/wp-includes/js/tinymce/themes/advanced/js/charmap.js
@@ -1,13 +1,6 @@
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-}
-
-var charmap = new Array();
+tinyMCEPopup.requireLangPack();
-// for mor details please see w3c.org
-// now here is the complete list ;)
-
-charmap = [
+var charmap = [
['&nbsp;', '&#160;', true, 'no-break space'],
['&amp;', '&#38;', true, 'ampersand'],
['&quot;', '&#34;', true, 'quotation mark'],
@@ -270,32 +263,37 @@ charmap = [
['&shy;', '&#173;', false,'soft hyphen']
];
+tinyMCEPopup.onInit.add(function() {
+ tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
+});
+
function renderCharMapHTML() {
- var charsPerRow = 20, tdWidth=20, tdHeight=20;
+ var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
var cols=-1;
- for (var i=0; i<charmap.length; i++) {
+
+ for (i=0; i<charmap.length; i++) {
if (charmap[i][2]==true) {
cols++;
html += ''
- + '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"'
- + ' onmouseover="this.className=\'charmapOver\';'
- + 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
- + ' onmouseout="this.className=\'charmap\';"'
- + ' nowrap="nowrap" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');"><a style="text-decoration: none;" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+ + '<td class="charmap">'
+ + '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+ charmap[i][1]
+ '</a></td>';
if ((cols+1) % charsPerRow == 0)
html += '</tr><tr height="' + tdHeight + '">';
}
}
+
if (cols % charsPerRow > 0) {
var padd = charsPerRow - (cols % charsPerRow);
for (var i=0; i<padd-1; i++)
html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
}
+
html += '</tr></table>';
- document.write(html);
+
+ return html;
}
function insertChar(chr) {
@@ -305,6 +303,7 @@ function insertChar(chr) {
if (tinyMCEPopup.isWindow)
window.focus();
+ tinyMCEPopup.editor.focus();
tinyMCEPopup.close();
}
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js b/wp-includes/js/tinymce/themes/advanced/js/color_picker.js
index 9236fd0..148d7f5 100644
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js
+++ b/wp-includes/js/tinymce/themes/advanced/js/color_picker.js
@@ -1,3 +1,5 @@
+tinyMCEPopup.requireLangPack();
+
var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
var colors = new Array(
@@ -57,10 +59,9 @@ var named = {
};
function init() {
- var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+ var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
- if (tinyMCE.isMSIE)
- tinyMCEPopup.resizeToInnerSize();
+ tinyMCEPopup.resizeToInnerSize();
generatePicker();
@@ -75,9 +76,13 @@ function init() {
}
function insertAction() {
- var color = document.getElementById("color").value;
+ var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
+
+ tinyMCEPopup.restoreSelection();
+
+ if (f)
+ f(color);
- tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
tinyMCEPopup.close();
}
@@ -86,7 +91,7 @@ function showColor(color, name) {
document.getElementById("colorname").innerHTML = name;
document.getElementById("preview").style.backgroundColor = color;
- document.getElementById("color").value = color;
+ document.getElementById("color").value = color.toLowerCase();
}
function convertRGBToHex(col) {
@@ -152,9 +157,9 @@ function generateWebColors() {
+ '<tr>';
for (i=0; i<colors.length; i++) {
- h += '<td bgcolor="' + colors[i] + '">'
- + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">'
- + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>';
+ h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+ + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
+ + '</a></td>';
if ((i+1) % 18 == 0)
h += '</tr><tr>';
}
@@ -190,9 +195,9 @@ function computeColor(e) {
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
- partWidth = document.getElementById('colorpicker').width / 6;
+ partWidth = document.getElementById('colors').width / 6;
partDetail = detail / 2;
- imHeight = document.getElementById('colorpicker').height;
+ imHeight = document.getElementById('colors').height;
r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
@@ -237,4 +242,4 @@ function changeFinalColor(color) {
document.getElementById('color').value = color;
}
-window.focus();
+tinyMCEPopup.onInit.add(init);
diff --git a/wp-includes/js/tinymce/themes/advanced/js/image.js b/wp-includes/js/tinymce/themes/advanced/js/image.js
new file mode 100644
index 0000000..ebe9348
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/js/image.js
@@ -0,0 +1,254 @@
+var ImageDialog = {
+ preInit : function() {
+ var url;
+
+ tinyMCEPopup.requireLangPack();
+
+ if (url = tinyMCEPopup.getParam("external_image_list_url"))
+ document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+ },
+
+ init : function() {
+ var f = document.forms[0], ed = tinyMCEPopup.editor;
+
+ // Setup browse button
+ document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
+ if (isVisible('srcbrowser'))
+ document.getElementById('src').style.width = '180px';
+
+ e = ed.selection.getNode();
+
+ this.fillFileList('image_list', 'tinyMCEImageList');
+
+ if (e.nodeName == 'IMG') {
+ f.src.value = ed.dom.getAttrib(e, 'src');
+ f.alt.value = ed.dom.getAttrib(e, 'alt');
+ f.border.value = this.getAttrib(e, 'border');
+ f.vspace.value = this.getAttrib(e, 'vspace');
+ f.hspace.value = this.getAttrib(e, 'hspace');
+ f.width.value = ed.dom.getAttrib(e, 'width');
+ f.height.value = ed.dom.getAttrib(e, 'height');
+ f.insert.value = ed.getLang('update');
+ f.class_name.value = ed.dom.getAttrib(e, 'class');
+ this.styleVal = ed.dom.getAttrib(e, 'style');
+ selectByValue(f, 'image_list', f.src.value);
+ selectByValue(f, 'align', this.getAttrib(e, 'align'));
+ this.updateStyle();
+ }
+ },
+
+ fillFileList : function(id, l) {
+ var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+ l = window[l];
+
+ if (l && l.length > 0) {
+ lst.options[lst.options.length] = new Option('', '');
+
+ tinymce.each(l, function(o) {
+ lst.options[lst.options.length] = new Option(o[0], o[1]);
+ });
+ } else
+ dom.remove(dom.getParent(id, 'tr'));
+ },
+
+ update : function() {
+ var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
+
+ tinyMCEPopup.restoreSelection();
+
+ if (f.src.value === '') {
+ if (ed.selection.getNode().nodeName == 'IMG') {
+ ed.dom.remove(ed.selection.getNode());
+ ed.execCommand('mceRepaint');
+ }
+
+ tinyMCEPopup.close();
+ return;
+ }
+
+ if (!ed.settings.inline_styles) {
+ args = tinymce.extend(args, {
+ vspace : nl.vspace.value,
+ hspace : nl.hspace.value,
+ border : nl.border.value,
+ align : getSelectValue(f, 'align')
+ });
+ } else
+ args.style = this.styleVal;
+
+ tinymce.extend(args, {
+ src : f.src.value,
+ alt : f.alt.value,
+ width : f.width.value,
+ height : f.height.value,
+ 'class' : f.class_name.value
+ });
+
+ el = ed.selection.getNode();
+
+ if (el && el.nodeName == 'IMG') {
+ ed.dom.setAttribs(el, args);
+ } else {
+ ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />', {skip_undo : 1});
+ ed.dom.setAttribs('__mce_tmp', args);
+ ed.dom.setAttrib('__mce_tmp', 'id', '');
+ ed.undoManager.add();
+ }
+
+ tinyMCEPopup.close();
+ },
+
+ updateStyle : function() {
+ var dom = tinyMCEPopup.dom, st, v, cls, oldcls, rep, f = document.forms[0];
+
+ if (tinyMCEPopup.editor.settings.inline_styles) {
+ st = tinyMCEPopup.dom.parseStyle(this.styleVal);
+
+ // Handle align
+ v = getSelectValue(f, 'align');
+ cls = f.class_name.value || '';
+ cls = cls ? cls.replace(/alignright\s*|alignleft\s*/g, '') : '';
+ cls = cls ? cls.replace(/^\s*(.+?)\s*$/, '$1') : '';
+ if (v) {
+ if (v == 'left' || v == 'right') {
+ st['float'] = v;
+ delete st['vertical-align'];
+ oldcls = cls ? ' '+cls : '';
+ f.class_name.value = 'align' + v + oldcls;
+ } else {
+ st['vertical-align'] = v;
+ delete st['float'];
+ f.class_name.value = cls;
+ }
+ } else {
+ delete st['float'];
+ delete st['vertical-align'];
+ f.class_name.value = cls;
+ }
+
+ // Handle border
+ v = f.border.value;
+ if (v || v == '0') {
+ if (v == '0')
+ st['border'] = '0';
+ else
+ st['border'] = v + 'px solid black';
+ } else
+ delete st['border'];
+
+ // Handle hspace
+ v = f.hspace.value;
+ if (v) {
+ delete st['margin'];
+ st['margin-left'] = v + 'px';
+ st['margin-right'] = v + 'px';
+ } else {
+ delete st['margin-left'];
+ delete st['margin-right'];
+ }
+
+ // Handle vspace
+ v = f.vspace.value;
+ if (v) {
+ delete st['margin'];
+ st['margin-top'] = v + 'px';
+ st['margin-bottom'] = v + 'px';
+ } else {
+ delete st['margin-top'];
+ delete st['margin-bottom'];
+ }
+
+ // Merge
+ st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st));
+ this.styleVal = dom.serializeStyle(st);
+ }
+ },
+
+ getAttrib : function(e, at) {
+ var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
+
+ if (ed.settings.inline_styles) {
+ switch (at) {
+ case 'align':
+ if (v = dom.getStyle(e, 'float'))
+ return v;
+
+ if (v = dom.getStyle(e, 'vertical-align'))
+ return v;
+
+ break;
+
+ case 'hspace':
+ v = dom.getStyle(e, 'margin-left')
+ v2 = dom.getStyle(e, 'margin-right');
+ if (v && v == v2)
+ return parseInt(v.replace(/[^0-9]/g, ''));
+
+ break;
+
+ case 'vspace':
+ v = dom.getStyle(e, 'margin-top')
+ v2 = dom.getStyle(e, 'margin-bottom');
+ if (v && v == v2)
+ return parseInt(v.replace(/[^0-9]/g, ''));
+
+ break;
+
+ case 'border':
+ v = 0;
+
+ tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
+ sv = dom.getStyle(e, 'border-' + sv + '-width');
+
+ // False or not the same as prev
+ if (!sv || (sv != v && v !== 0)) {
+ v = 0;
+ return false;
+ }
+
+ if (sv)
+ v = sv;
+ });
+
+ if (v)
+ return parseInt(v.replace(/[^0-9]/g, ''));
+
+ break;
+ }
+ }
+
+ if (v = dom.getAttrib(e, at))
+ return v;
+
+ return '';
+ },
+
+ resetImageData : function() {
+ var f = document.forms[0];
+
+ f.width.value = f.height.value = "";
+ },
+
+ updateImageData : function() {
+ var f = document.forms[0], t = ImageDialog;
+
+ if (f.width.value == "")
+ f.width.value = t.preloadImg.width;
+
+ if (f.height.value == "")
+ f.height.value = t.preloadImg.height;
+ },
+
+ getImageData : function() {
+ var f = document.forms[0];
+
+ this.preloadImg = new Image();
+ this.preloadImg.onload = this.updateImageData;
+ this.preloadImg.onerror = this.resetImageData;
+ this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
+ }
+};
+
+ImageDialog.preInit();
+tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
diff --git a/wp-includes/js/tinymce/themes/advanced/js/link.js b/wp-includes/js/tinymce/themes/advanced/js/link.js
new file mode 100644
index 0000000..bf310a3
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/js/link.js
@@ -0,0 +1,126 @@
+tinyMCEPopup.requireLangPack();
+
+var LinkDialog = {
+ preInit : function() {
+ var url;
+
+ if (url = tinyMCEPopup.getParam("external_link_list_url"))
+ document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+ },
+
+ init : function() {
+ var f = document.forms[0], ed = tinyMCEPopup.editor;
+
+ // Setup browse button
+ document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');
+ if (isVisible('hrefbrowser'))
+ document.getElementById('href').style.width = '180px';
+
+ this.fillClassList('class_list');
+ this.fillFileList('link_list', 'tinyMCELinkList');
+ this.fillTargetList('target_list');
+
+ if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {
+ f.href.value = ed.dom.getAttrib(e, 'href');
+ f.linktitle.value = ed.dom.getAttrib(e, 'title');
+ f.insert.value = ed.getLang('update');
+ selectByValue(f, 'link_list', f.href.value);
+ selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));
+ selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));
+ }
+ },
+
+ update : function() {
+ var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
+
+ tinyMCEPopup.restoreSelection();
+
+ // Remove element if there is no href
+ if (!f.href.value) {
+ e = ed.dom.getParent(ed.selection.getNode(), 'A');
+ if (e) {
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+ b = ed.selection.getBookmark();
+ ed.dom.remove(e, 1);
+ ed.selection.moveToBookmark(b);
+ tinyMCEPopup.execCommand("mceEndUndoLevel");
+ tinyMCEPopup.close();
+ return;
+ }
+ }
+
+ ed.execCommand('mceInsertLink', false, {
+ href : f.href.value,
+ title : f.linktitle.value,
+ target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
+ 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+ });
+
+ tinyMCEPopup.close();
+ },
+
+ checkPrefix : function(n) {
+ if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
+ n.value = 'mailto:' + n.value;
+
+ if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
+ n.value = 'http://' + n.value;
+ },
+
+ fillFileList : function(id, l) {
+ var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+ l = window[l];
+
+ if (l && l.length > 0) {
+ lst.options[lst.options.length] = new Option('', '');
+
+ tinymce.each(l, function(o) {
+ lst.options[lst.options.length] = new Option(o[0], o[1]);
+ });
+ } else
+ dom.remove(dom.getParent(id, 'tr'));
+ },
+
+ fillClassList : function(id) {
+ var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+ if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
+ cl = [];
+
+ tinymce.each(v.split(';'), function(v) {
+ var p = v.split('=');
+
+ cl.push({'title' : p[0], 'class' : p[1]});
+ });
+ } else
+ cl = tinyMCEPopup.editor.dom.getClasses();
+
+ if (cl.length > 0) {
+ lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+
+ tinymce.each(cl, function(o) {
+ lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
+ });
+ } else
+ dom.remove(dom.getParent(id, 'tr'));
+ },
+
+ fillTargetList : function(id) {
+ var dom = tinyMCEPopup.dom, lst = dom.get(id), v;
+
+ lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+ lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
+ lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');
+
+ if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
+ tinymce.each(v.split(','), function(v) {
+ v = v.split('=');
+ html += '<option value="' + v[1] + '">' + v[0] + '</option>';
+ });
+ }
+ }
+};
+
+LinkDialog.preInit();
+tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js b/wp-includes/js/tinymce/themes/advanced/js/source_editor.js
index 83648be..a6235a3 100644
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
+++ b/wp-includes/js/tinymce/themes/advanced/js/source_editor.js
@@ -1,33 +1,36 @@
+tinyMCEPopup.requireLangPack();
+tinyMCEPopup.onInit.add(onLoadInit);
+
function saveContent() {
- tinyMCE.setContent(document.getElementById('htmlSource').value);
- tinyMCE.closeWindow(window);
+ tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value);
+ tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Remove Gecko spellchecking
- if (tinyMCE.isGecko)
- document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
-
- document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'));
+ if (tinymce.isGecko)
+ document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
- resizeInputs();
+ document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent();
- if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
+ if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
setWrap('soft');
document.getElementById('wraped').checked = true;
}
+
+ resizeInputs();
}
function setWrap(val) {
- var s = document.getElementById('htmlSource');
+ var v, n, s = document.getElementById('htmlSource');
s.wrap = val;
- if (tinyMCE.isGecko || tinyMCE.isOpera) {
- var v = s.value;
- var n = s.cloneNode(false);
+ if (!tinymce.isIE) {
+ v = s.value;
+ n = s.cloneNode(false);
n.setAttribute("wrap", val);
s.parentNode.replaceChild(n, s);
n.value = v;
@@ -46,11 +49,11 @@ var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
var el = document.getElementById('htmlSource');
- if (!tinyMCE.isMSIE) {
- wHeight = self.innerHeight - 60;
+ if (!tinymce.isIE) {
+ wHeight = self.innerHeight - 65;
wWidth = self.innerWidth - 16;
} else {
- wHeight = document.body.clientHeight - 60;
+ wHeight = document.body.clientHeight - 70;
wWidth = document.body.clientWidth - 16;
}
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/about.js b/wp-includes/js/tinymce/themes/advanced/jscripts/about.js
deleted file mode 100644
index f60e6f6..0000000
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/about.js
+++ /dev/null
@@ -1,75 +0,0 @@
-function init() {
- var inst;
-
- tinyMCEPopup.resizeToInnerSize();
- inst = tinyMCE.selectedInstance;
-
- // Give FF some time
- window.setTimeout('insertHelpIFrame();', 10);
-
- var tcont = document.getElementById('plugintablecontainer');
- var plugins = tinyMCE.getParam('plugins', '', true, ',');
- if (plugins.length == 0)
- document.getElementById('plugins_tab').style.display = 'none';
-
- var html = "";
- html += '<table id="plugintable">';
- html += '<thead>';
- html += '<tr>';
- html += '<td>' + tinyMCE.getLang('lang_plugin') + '</td>';
- html += '<td>' + tinyMCE.getLang('lang_author') + '</td>';
- html += '<td>' + tinyMCE.getLang('lang_version') + '</td>';
- html += '</tr>';
- html += '</thead>';
- html += '<tbody>';
-
- for (var i=0; i<inst.plugins.length; i++) {
- var info = getPluginInfo(inst.plugins[i]);
-
- html += '<tr>';
-
- if (info.infourl != null && info.infourl != '')
- html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="mceplugin">' + info.longname + '</a></td>';
- else
- html += '<td width="50%" title="' + plugins[i] + '">' + info.longname + '</td>';
-
- if (info.authorurl != null && info.authorurl != '')
- html += '<td width="35%"><a href="' + info.authorurl + '" target="mceplugin">' + info.author + '</a></td>';
- else
- html += '<td width="35%">' + info.author + '</td>';
-
- html += '<td width="15%">' + info.version + '</td>';
- html += '</tr>';
- }
-
- html += '</tbody>';
- html += '</table>';
-
- tcont.innerHTML = html;
-}
-
-function getPluginInfo(name) {
- if (tinyMCE.plugins[name].getInfo)
- return tinyMCE.plugins[name].getInfo();
-
- return {
- longname : name,
- authorurl : '',
- infourl : '',
- author : '--',
- version : '--'
- };
-}
-
-function insertHelpIFrame() {
- var html = '<iframe width="100%" height="300" src="' + tinyMCE.themeURL + "/docs/" + tinyMCE.settings['docs_language'] + "/index.htm" + '"></iframe>';
-
- document.getElementById('iframecontainer').innerHTML = html;
-
- html = '';
- html += '<a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a> ';
- html += '<a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="http://sourceforge.net/sflogo.php?group_id=103281" alt="Hosted By Sourceforge" border="0" /></a> ';
- html += '<a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="http://tinymce.moxiecode.com/images/fm.gif" alt="Also on freshmeat" border="0" /></a> ';
-
- document.getElementById('buttoncontainer').innerHTML = html;
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js b/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js
deleted file mode 100644
index f2e5d48..0000000
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js
+++ /dev/null
@@ -1,74 +0,0 @@
-var action, element;
-
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
- var anchor = tinyMCE.getParentElement(inst.getFocusElement(), "a", "name");
- var img = inst.getFocusElement();
- action = 'insert';
-
- if (anchor != null) {
- element = anchor;
- action = "update";
- }
-
- if (tinyMCE.getAttrib(img, "class") == "mceItemAnchor") {
- element = img;
- action = "update";
- }
-
- if (action == "update")
- document.forms[0].anchorName.value = element.nodeName == "IMG" ? element.getAttribute("title") : element.getAttribute("name");
-
- document.forms[0].insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
-}
-
-function insertAnchor() {
- var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
- var name = document.forms[0].anchorName.value, e;
-
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
- if (action == "update") {
- if (element.nodeName == "IMG")
- element.setAttribute("title", name);
- else
- element.setAttribute("name", name);
- } else {
- var rng = inst.getRng();
-
- if (rng.collapse)
- rng.collapse(false);
-
- name = name.replace(/&/g, '&amp;');
- name = name.replace(/\"/g, '&quot;');
- name = name.replace(/</g, '&lt;');
- name = name.replace(/>/g, '&gt;');
-
- // Fix for bug #1447335
- if (tinyMCE.isGecko)
- html = '<a id="mceNewAnchor" name="' + name + '"></a>';
- else
- html = '<a name="' + name + '"></a>';
-
- tinyMCEPopup.execCommand("mceInsertContent", false, html);
-
- // Fix for bug #1447335 force cursor after the anchor element
- if (tinyMCE.isGecko) {
- e = inst.getDoc().getElementById('mceNewAnchor');
-
- if (e) {
- inst.selection.selectNode(e, true, false, false);
- e.removeAttribute('id');
- }
- }
-
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- }
-
- tinyMCEPopup.execCommand("mceEndUndoLevel");
-
- tinyMCE.triggerNodeChange();
- tinyMCEPopup.close();
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/image.js b/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
deleted file mode 100644
index 950c043..0000000
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
+++ /dev/null
@@ -1,81 +0,0 @@
-var url = tinyMCE.getParam("external_image_list_url");
-if (url != null) {
- // Fix relative
- if (url.charAt(0) != '/' && url.indexOf('://') == -1)
- url = tinyMCE.documentBasePath + "/" + url;
-
- document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
-}
-
-function insertImage() {
- var src = document.forms[0].src.value;
- var alt = document.forms[0].alt.value;
- var border = document.forms[0].border.value;
- var vspace = document.forms[0].vspace.value;
- var hspace = document.forms[0].hspace.value;
- var width = document.forms[0].width.value;
- var height = document.forms[0].height.value;
- var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
-
- tinyMCEPopup.restoreSelection();
- tinyMCE.themes['advanced']._insertImage(src, alt, border, hspace, vspace, width, height, align);
- tinyMCEPopup.close();
-}
-
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
-
- var formObj = document.forms[0];
-
- for (var i=0; i<document.forms[0].align.options.length; i++) {
- if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align'))
- document.forms[0].align.options.selectedIndex = i;
- }
-
- formObj.src.value = tinyMCE.getWindowArg('src');
- formObj.alt.value = tinyMCE.getWindowArg('alt');
- formObj.border.value = tinyMCE.getWindowArg('border');
- formObj.vspace.value = tinyMCE.getWindowArg('vspace');
- formObj.hspace.value = tinyMCE.getWindowArg('hspace');
- formObj.width.value = tinyMCE.getWindowArg('width');
- formObj.height.value = tinyMCE.getWindowArg('height');
- formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
-
- // Handle file browser
- if (isVisible('srcbrowser'))
- document.getElementById('src').style.width = '180px';
-
- // Auto select image in list
- if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
- for (var i=0; i<formObj.image_list.length; i++) {
- if (formObj.image_list.options[i].value == tinyMCE.getWindowArg('src'))
- formObj.image_list.options[i].selected = true;
- }
- }
-}
-
-var preloadImg = new Image();
-
-function resetImageData() {
- var formObj = document.forms[0];
- formObj.width.value = formObj.height.value = "";
-}
-
-function updateImageData() {
- var formObj = document.forms[0];
-
- if (formObj.width.value == "")
- formObj.width.value = preloadImg.width;
-
- if (formObj.height.value == "")
- formObj.height.value = preloadImg.height;
-}
-
-function getImageData() {
- preloadImg = new Image();
- tinyMCE.addEvent(preloadImg, "load", updateImageData);
- tinyMCE.addEvent(preloadImg, "error", function () {var formObj = document.forms[0];formObj.width.value = formObj.height.value = "";});
- preloadImg.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], document.forms[0].src.value);
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/link.js b/wp-includes/js/tinymce/themes/advanced/jscripts/link.js
deleted file mode 100644
index 36df14e..0000000
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/link.js
+++ /dev/null
@@ -1,82 +0,0 @@
-var url = tinyMCE.getParam("external_link_list_url");
-if (url != null) {
- // Fix relative
- if (url.charAt(0) != '/' && url.indexOf('://') == -1)
- url = tinyMCE.documentBasePath + "/" + url;
-
- document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
-}
-
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
-
- // Handle file browser
- if (isVisible('hrefbrowser'))
- document.getElementById('href').style.width = '180px';
-
- var formObj = document.forms[0];
-
- for (var i=0; i<document.forms[0].target.options.length; i++) {
- var option = document.forms[0].target.options[i];
-
- if (option.value == tinyMCE.getWindowArg('target'))
- option.selected = true;
- }
-
- // WordPress -- next 3 lines
- document.forms[0].href.value = tinyMCE.getWindowArg('href') || 'http://';
- document.forms[0].href.select();
- document.forms[0].href.focus();
-
- document.forms[0].linktitle.value = tinyMCE.getWindowArg('title');
- document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
-
- addClassesToList('styleSelect', 'theme_advanced_link_styles');
- selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true);
-
- // Hide css select row if no CSS classes
- if (formObj.styleSelect && formObj.styleSelect.options.length <= 1) {
- var sr = document.getElementById('styleSelectRow');
- sr.style.display = 'none';
- sr.parentNode.removeChild(sr);
- }
-
- // Auto select link in list
- if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) {
- var formObj = document.forms[0];
-
- for (var i=0; i<formObj.link_list.length; i++) {
- if (formObj.link_list.options[i].value == tinyMCE.getWindowArg('href'))
- formObj.link_list.options[i].selected = true;
- }
- }
-}
-
-function checkPrefix(n) {
- if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCE.getLang('lang_is_email')))
- n.value = 'mailto:' + n.value;
-
- if (/^\s*www./i.test(n.value) && confirm(tinyMCE.getLang('lang_is_external')))
- n.value = 'http://' + n.value;
-}
-
-function insertLink() {
- var href = document.forms[0].href.value;
- var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value;
- var title = document.forms[0].linktitle.value;
- var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : "";
- var dummy;
-
- // WordPress: Make anchors absolute;
- if (href.charAt(0) == '#')
- href = tinyMCE.settings.document_base_url + href;
-
- if (target == '_self')
- target = '';
-
- tinyMCEPopup.restoreSelection();
- tinyMCE.themes['advanced']._insertLink(href, target, title, dummy, style_class);
- tinyMCEPopup.close();
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/langs/en.js b/wp-includes/js/tinymce/themes/advanced/langs/en.js
deleted file mode 100644
index 8409e58..0000000
--- a/wp-includes/js/tinymce/themes/advanced/langs/en.js
+++ /dev/null
@@ -1,93 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-theme_style_select : '-- Styles --',
-theme_code_desc : 'Edit HTML Source',
-theme_code_title : 'HTML Source Editor',
-theme_code_wordwrap : 'Word wrap',
-theme_sub_desc : 'Subscript',
-theme_sup_desc : 'Superscript',
-theme_hr_desc : 'Insert horizontal ruler',
-theme_removeformat_desc : 'Remove formatting',
-theme_custom1_desc : 'Your custom description here',
-insert_image_border : 'Border',
-insert_image_dimensions : 'Dimensions',
-insert_image_vspace : 'Vertical space',
-insert_image_hspace : 'Horizontal space',
-insert_image_align : 'Alignment',
-insert_image_align_default : '-- Not set --',
-insert_image_align_baseline : 'Baseline',
-insert_image_align_top : 'Top',
-insert_image_align_middle : 'Middle',
-insert_image_align_bottom : 'Bottom',
-insert_image_align_texttop : 'TextTop',
-insert_image_align_absmiddle : 'Absolute Middle',
-insert_image_align_absbottom : 'Absolute Bottom',
-insert_image_align_left : 'Left',
-insert_image_align_right : 'Right',
-theme_font_size : '-- Font size --',
-theme_fontdefault : '-- Font family --',
-theme_block : '-- Format --',
-theme_paragraph : 'Paragraph',
-theme_div : 'Div',
-theme_address : 'Address',
-theme_pre : 'Preformatted',
-theme_h1 : 'Heading 1',
-theme_h2 : 'Heading 2',
-theme_h3 : 'Heading 3',
-theme_h4 : 'Heading 4',
-theme_h5 : 'Heading 5',
-theme_h6 : 'Heading 6',
-theme_blockquote : 'Blockquote',
-theme_code : 'Code',
-theme_samp : 'Code sample',
-theme_dt : 'Definition term ',
-theme_dd : 'Definition description',
-theme_colorpicker_title : 'Select a color',
-theme_colorpicker_apply : 'Apply',
-theme_forecolor_desc : 'Select text color',
-theme_backcolor_desc : 'Select background color',
-theme_charmap_title : 'Select custom character',
-theme_charmap_desc : 'Insert custom character',
-theme_visualaid_desc : 'Toggle guidelines/invisible elements',
-insert_anchor_title : 'Insert/edit anchor',
-insert_anchor_name : 'Anchor name',
-theme_anchor_desc : 'Insert/edit anchor',
-theme_insert_link_titlefield : 'Title',
-theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
-theme_path : 'Path',
-cut_desc : 'Cut',
-copy_desc : 'Copy',
-paste_desc : 'Paste',
-link_list : 'Link list',
-image_list : 'Image list',
-browse : 'Browse',
-image_props_desc : 'Image properties',
-newdocument_desc : 'New document',
-class_name : 'Class',
-newdocument : 'Are you sure you want clear all contents?',
-about_title : 'About TinyMCE',
-about : 'About',
-license : 'License',
-plugins : 'Plugins',
-plugin : 'Plugin',
-author : 'Author',
-version : 'Version',
-loaded_plugins : 'Loaded plugins',
-help : 'Help',
-not_set : '-- Not set --',
-close : 'Close',
-toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
-invalid_data : 'Error: Invalid values entered, these are marked in red.',
-more_colors : 'More colors',
-color_picker_tab : 'Picker',
-color_picker : 'Color picker',
-web_colors_tab : 'Palette',
-web_colors : 'Palette colors',
-named_colors_tab : 'Named',
-named_colors : 'Named colors',
-color : 'Color:',
-color_name : 'Name:',
-is_email : 'The URL you entered seems to be an email address, do you want to add the required mailto: prefix?',
-is_external : 'The URL you entered seems to external link, do you want to add the required http:// prefix?'
-});
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/content.css b/wp-includes/js/tinymce/themes/advanced/skins/default/content.css
new file mode 100644
index 0000000..363aa9f
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/content.css
@@ -0,0 +1,25 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+body {background:#FFF;}
+body.mceForceColors {background:#FFF; color:#000;}
+h1 {font-size: 2em}
+h2 {font-size: 1.5em}
+h3 {font-size: 1.17em}
+h4 {font-size: 1em}
+h5 {font-size: .83em}
+h6 {font-size: .75em}
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
+a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
+img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
+img {border:0;}
+
+/* IE */
+* html body {
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css
new file mode 100644
index 0000000..497dda3
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css
@@ -0,0 +1,114 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+background:#F0F0EE;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#F0F0EE;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.button, .updateButton {
+border:0; margin:0; padding:0;
+font-weight:bold;
+width:94px; height:26px;
+background:url(img/buttons.png) 0 -26px;
+cursor:pointer;
+padding-bottom:2px;
+}
+
+#insert {background:url(img/buttons.png) 0 -52px;}
+#cancel {background:url(img/buttons.png) 0 0;}
+
+/* Browse */
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;} \ No newline at end of file
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png b/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png
new file mode 100644
index 0000000..7dd5841
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/anchor_symbol.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif
index 2eafd79..2eafd79 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/anchor_symbol.gif
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif
new file mode 100644
index 0000000..85e31df
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif
new file mode 100644
index 0000000..adfdddc
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif
new file mode 100644
index 0000000..5bb90fd
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif
new file mode 100644
index 0000000..ce4be63
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css
new file mode 100644
index 0000000..3f6df9c
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css
@@ -0,0 +1,210 @@
+/* Reset */
+.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
+.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
+.defaultSkin table td {vertical-align:middle}
+
+/* Containers */
+.defaultSkin table {background:#F0F0EE}
+.defaultSkin iframe {display:block; background:#FFF}
+.defaultSkin .mceToolbar {height:26px}
+.defaultSkin .mceLeft {text-align:left}
+.defaultSkin .mceRight {text-align:right}
+
+/* External */
+.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;}
+.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
+.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
+
+/* Layout */
+.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC}
+.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC}
+.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC}
+.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;}
+.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top}
+.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
+.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
+.defaultSkin .mceStatusbar div {float:left; margin:2px}
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
+.defaultSkin table.mceToolbar {margin-left:3px}
+.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
+.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
+.defaultSkin td.mceCenter {text-align:center;}
+.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;}
+.defaultSkin td.mceRight table {margin:0 0 0 auto;}
+
+/* Button */
+.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px;}
+.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
+.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
+.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30)}
+
+/* Separator */
+.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
+
+/* ListBox */
+.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
+.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
+.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
+.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}
+.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}
+.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}
+.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
+.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px}
+.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;}
+.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}
+
+/* SplitButton */
+.defaultSkin .mceSplitButton {width:32px; height:20px}
+.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
+.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
+.defaultSkin .mceSplitButton a.mceOpen {width:9px; border:1px solid #F0F0EE;}
+.defaultSkin .mceSplitButton span.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0;}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {border:1px solid #0A246A;}
+.defaultSkin table.mceSplitButtonEnabled:hover span.mceOpen, .defaultSkin .mceSplitButtonHover span.mceOpen, .defaultSkin .mceSplitButtonSelected span.mceOpen {background-color:#B2BBD0}
+.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled span.mceOpen {opacity:0.3; filter:alpha(opacity=30)}
+.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
+.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
+
+/* ColorSplitButton */
+.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
+.defaultSkin .mceColorSplitMenu td {padding:2px}
+.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
+.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
+.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
+.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
+.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}
+.defaultSkin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden}
+.defaultSkin .mce_forecolor, .defaultSkin .mce_backcolor {position:relative}
+
+/* Menu */
+.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8}
+.defaultSkin .mceNoIcons span.mceIcon {width:0;}
+.defaultSkin .mceNoIcons a .mceText {padding-left:10px}
+.defaultSkin .mceMenu table {background:#FFF}
+.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block}
+.defaultSkin .mceMenu td {height:20px}
+.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0}
+.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
+.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px}
+.defaultSkin .mceMenu pre.mceText {font-family:Monospace}
+.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
+.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
+.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px}
+.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD}
+.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
+.defaultSkin .mceMenuItemDisabled .mceText {color:#888}
+.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)}
+.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center}
+.defaultSkin .mceMenu span.mceMenuLine {display:none}
+.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
+
+/* Progress,Resize */
+.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF}
+.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
+.defaultSkin .mcePlaceHolder {border:1px dotted gray}
+
+/* Formats */
+.defaultSkin .mce_formatPreview a {font-size:10px}
+.defaultSkin .mce_p span.mceText {}
+.defaultSkin .mce_address span.mceText {font-style:italic}
+.defaultSkin .mce_pre span.mceText {font-family:monospace}
+.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
+.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
+.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
+.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
+.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
+.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
+
+/* Theme */
+.defaultSkin span.mce_bold {background-position:0 0}
+.defaultSkin span.mce_italic {background-position:-60px 0}
+.defaultSkin span.mce_underline {background-position:-140px 0}
+.defaultSkin span.mce_strikethrough {background-position:-120px 0}
+.defaultSkin span.mce_undo {background-position:-160px 0}
+.defaultSkin span.mce_redo {background-position:-100px 0}
+.defaultSkin span.mce_cleanup {background-position:-40px 0}
+.defaultSkin span.mce_bullist {background-position:-20px 0}
+.defaultSkin span.mce_numlist {background-position:-80px 0}
+.defaultSkin span.mce_justifyleft {background-position:-460px 0}
+.defaultSkin span.mce_justifyright {background-position:-480px 0}
+.defaultSkin span.mce_justifycenter {background-position:-420px 0}
+.defaultSkin span.mce_justifyfull {background-position:-440px 0}
+.defaultSkin span.mce_anchor {background-position:-200px 0}
+.defaultSkin span.mce_indent {background-position:-400px 0}
+.defaultSkin span.mce_outdent {background-position:-540px 0}
+.defaultSkin span.mce_link {background-position:-500px 0}
+.defaultSkin span.mce_unlink {background-position:-640px 0}
+.defaultSkin span.mce_sub {background-position:-600px 0}
+.defaultSkin span.mce_sup {background-position:-620px 0}
+.defaultSkin span.mce_removeformat {background-position:-580px 0}
+.defaultSkin span.mce_newdocument {background-position:-520px 0}
+.defaultSkin span.mce_image {background-position:-380px 0}
+.defaultSkin span.mce_help {background-position:-340px 0}
+.defaultSkin span.mce_code {background-position:-260px 0}
+.defaultSkin span.mce_hr {background-position:-360px 0}
+.defaultSkin span.mce_visualaid {background-position:-660px 0}
+.defaultSkin span.mce_charmap {background-position:-240px 0}
+.defaultSkin span.mce_paste {background-position:-560px 0}
+.defaultSkin span.mce_copy {background-position:-700px 0}
+.defaultSkin span.mce_cut {background-position:-680px 0}
+.defaultSkin span.mce_blockquote {background-position:-220px 0}
+.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0}
+.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0}
+.defaultSkin .mce_forecolorpicker {background-position:-720px 0}
+.defaultSkin .mce_backcolorpicker {background-position:-760px 0}
+
+/* Plugins */
+.defaultSkin span.mce_advhr {background-position:-0px -20px}
+.defaultSkin span.mce_ltr {background-position:-20px -20px}
+.defaultSkin span.mce_rtl {background-position:-40px -20px}
+.defaultSkin span.mce_emotions {background-position:-60px -20px}
+.defaultSkin span.mce_fullpage {background-position:-80px -20px}
+.defaultSkin span.mce_fullscreen {background-position:-100px -20px}
+.defaultSkin span.mce_iespell {background-position:-120px -20px}
+.defaultSkin span.mce_insertdate {background-position:-140px -20px}
+.defaultSkin span.mce_inserttime {background-position:-160px -20px}
+.defaultSkin span.mce_absolute {background-position:-180px -20px}
+.defaultSkin span.mce_backward {background-position:-200px -20px}
+.defaultSkin span.mce_forward {background-position:-220px -20px}
+.defaultSkin span.mce_insert_layer {background-position:-240px -20px}
+.defaultSkin span.mce_insertlayer {background-position:-260px -20px}
+.defaultSkin span.mce_movebackward {background-position:-280px -20px}
+.defaultSkin span.mce_moveforward {background-position:-300px -20px}
+.defaultSkin span.mce_media {background-position:-320px -20px}
+.defaultSkin span.mce_nonbreaking {background-position:-340px -20px}
+.defaultSkin span.mce_pastetext {background-position:-360px -20px}
+.defaultSkin span.mce_pasteword {background-position:-380px -20px}
+.defaultSkin span.mce_selectall {background-position:-400px -20px}
+.defaultSkin span.mce_preview {background-position:-420px -20px}
+.defaultSkin span.mce_print {background-position:-440px -20px}
+.defaultSkin span.mce_cancel {background-position:-460px -20px}
+.defaultSkin span.mce_save {background-position:-480px -20px}
+.defaultSkin span.mce_replace {background-position:-500px -20px}
+.defaultSkin span.mce_search {background-position:-520px -20px}
+.defaultSkin span.mce_styleprops {background-position:-560px -20px}
+.defaultSkin span.mce_table {background-position:-580px -20px}
+.defaultSkin span.mce_cell_props {background-position:-600px -20px}
+.defaultSkin span.mce_delete_table {background-position:-620px -20px}
+.defaultSkin span.mce_delete_col {background-position:-640px -20px}
+.defaultSkin span.mce_delete_row {background-position:-660px -20px}
+.defaultSkin span.mce_col_after {background-position:-680px -20px}
+.defaultSkin span.mce_col_before {background-position:-700px -20px}
+.defaultSkin span.mce_row_after {background-position:-720px -20px}
+.defaultSkin span.mce_row_before {background-position:-740px -20px}
+.defaultSkin span.mce_merge_cells {background-position:-760px -20px}
+.defaultSkin span.mce_table_props {background-position:-980px -20px}
+.defaultSkin span.mce_row_props {background-position:-780px -20px}
+.defaultSkin span.mce_split_cells {background-position:-800px -20px}
+.defaultSkin span.mce_template {background-position:-820px -20px}
+.defaultSkin span.mce_visualchars {background-position:-840px -20px}
+.defaultSkin span.mce_abbr {background-position:-860px -20px}
+.defaultSkin span.mce_acronym {background-position:-880px -20px}
+.defaultSkin span.mce_attribs {background-position:-900px -20px}
+.defaultSkin span.mce_cite {background-position:-920px -20px}
+.defaultSkin span.mce_del {background-position:-940px -20px}
+.defaultSkin span.mce_ins {background-position:-960px -20px}
+.defaultSkin span.mce_pagebreak {background-position:0 -40px}
+.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
new file mode 100644
index 0000000..a776ac9
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
@@ -0,0 +1,25 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+body {background:#FFF;}
+body.mceForceColors {background:#FFF; color:#000;}
+h1 {font-size: 2em}
+h2 {font-size: 1.5em}
+h3 {font-size: 1.17em}
+h4 {font-size: 1em}
+h5 {font-size: .83em}
+h6 {font-size: .75em}
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
+a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;}
+img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;}
+img {border:0;}
+
+/* IE */
+* html body {
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
new file mode 100644
index 0000000..e630fa7
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
@@ -0,0 +1,113 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+background:#F0F0EE;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#F0F0EE;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.button, .updateButton {
+border:0; margin:0; padding:0;
+font-weight:bold;
+width:94px; height:26px;
+background:url(../default/img/buttons.png) 0 -26px;
+cursor:pointer;
+padding-bottom:2px;
+}
+
+#insert {background:url(../default/img/buttons.png) 0 -52px;}
+#cancel {background:url(../default/img/buttons.png) 0 0;}
+
+/* Browse */
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png
new file mode 100644
index 0000000..12cfb41
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png
new file mode 100644
index 0000000..8996c74
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png
new file mode 100644
index 0000000..bd5d255
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
new file mode 100644
index 0000000..6a83b08
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
@@ -0,0 +1,211 @@
+/* Reset */
+.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
+.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
+.o2k7Skin table td {vertical-align:middle}
+
+/* Containers */
+.o2k7Skin table {background:#E5EFFD}
+.o2k7Skin iframe {display:block; background:#FFF}
+.o2k7Skin .mceToolbar {height:26px}
+
+/* External */
+.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none}
+.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
+.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
+
+/* Layout */
+.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD}
+.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD}
+.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD}
+.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
+.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}
+.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}
+.o2k7Skin .mceStatusbar div {float:left; padding:2px}
+.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.o2k7Skin .mceStatusbar a:hover {text-decoration:underline}
+.o2k7Skin table.mceToolbar {margin-left:3px}
+.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;}
+.o2k7Skin .mceToolbar td.mceFirst span {margin:0}
+.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px}
+.o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none}
+.o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px}
+.o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
+.o2k7Skin td.mceCenter {text-align:center;}
+.o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;}
+.o2k7Skin td.mceRight table {margin:0 0 0 auto;}
+
+/* Button */
+.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px}
+.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px}
+.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
+.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
+.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px}
+.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30)}
+
+/* Separator */
+.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}
+
+/* ListBox */
+.o2k7Skin .mceListBox {margin-left:3px}
+.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block}
+.o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
+.o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0}
+.o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF}
+.o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px}
+.o2k7Skin .mceListBoxDisabled .mceText {color:gray}
+.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
+.o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px}
+.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;}
+
+/* SplitButton */
+.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px}
+.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
+.o2k7Skin .mceSplitButton a.mceAction {width:22px}
+.o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px}
+.o2k7Skin .mceSplitButton a.mceOpen {width:10px}
+.o2k7Skin .mceSplitButton span.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
+.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
+.o2k7Skin table.mceSplitButtonEnabled:hover span.mceOpen, .o2k7Skin .mceSplitButtonHover span.mceOpen, .o2k7Skin .mceSplitButtonSelected span.mceOpen {background-position:-44px -44px}
+.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; filter:alpha(opacity=30)}
+.o2k7Skin .mceSplitButtonActive {background-position:0 -44px}
+
+/* ColorSplitButton */
+.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
+.o2k7Skin .mceColorSplitMenu td {padding:2px}
+.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
+.o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
+.o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
+.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
+.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A}
+.o2k7Skin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden}
+.o2k7Skin .mce_forecolor, .o2k7Skin .mce_backcolor {position:relative}
+
+/* Menu */
+.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD}
+.o2k7Skin .mceNoIcons span.mceIcon {width:0;}
+.o2k7Skin .mceNoIcons a .mceText {padding-left:10px}
+.o2k7Skin .mceMenu table {background:#FFF}
+.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block}
+.o2k7Skin .mceMenu td {height:20px}
+.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0}
+.o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
+.o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px}
+.o2k7Skin .mceMenu pre.mceText {font-family:Monospace}
+.o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
+.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
+.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px}
+.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD}
+.o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
+.o2k7Skin .mceMenuItemDisabled .mceText {color:#888}
+.o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)}
+.o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center}
+.o2k7Skin .mceMenu span.mceMenuLine {display:none}
+.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}
+
+/* Progress,Resize */
+.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF}
+.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
+.o2k7Skin .mcePlaceHolder {border:1px dotted gray}
+
+/* Formats */
+.o2k7Skin .mce_formatPreview a {font-size:10px}
+.o2k7Skin .mce_p span.mceText {}
+.o2k7Skin .mce_address span.mceText {font-style:italic}
+.o2k7Skin .mce_pre span.mceText {font-family:monospace}
+.o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
+.o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
+.o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
+.o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
+.o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
+.o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
+
+/* Theme */
+.o2k7Skin span.mce_bold {background-position:0 0}
+.o2k7Skin span.mce_italic {background-position:-60px 0}
+.o2k7Skin span.mce_underline {background-position:-140px 0}
+.o2k7Skin span.mce_strikethrough {background-position:-120px 0}
+.o2k7Skin span.mce_undo {background-position:-160px 0}
+.o2k7Skin span.mce_redo {background-position:-100px 0}
+.o2k7Skin span.mce_cleanup {background-position:-40px 0}
+.o2k7Skin span.mce_bullist {background-position:-20px 0}
+.o2k7Skin span.mce_numlist {background-position:-80px 0}
+.o2k7Skin span.mce_justifyleft {background-position:-460px 0}
+.o2k7Skin span.mce_justifyright {background-position:-480px 0}
+.o2k7Skin span.mce_justifycenter {background-position:-420px 0}
+.o2k7Skin span.mce_justifyfull {background-position:-440px 0}
+.o2k7Skin span.mce_anchor {background-position:-200px 0}
+.o2k7Skin span.mce_indent {background-position:-400px 0}
+.o2k7Skin span.mce_outdent {background-position:-540px 0}
+.o2k7Skin span.mce_link {background-position:-500px 0}
+.o2k7Skin span.mce_unlink {background-position:-640px 0}
+.o2k7Skin span.mce_sub {background-position:-600px 0}
+.o2k7Skin span.mce_sup {background-position:-620px 0}
+.o2k7Skin span.mce_removeformat {background-position:-580px 0}
+.o2k7Skin span.mce_newdocument {background-position:-520px 0}
+.o2k7Skin span.mce_image {background-position:-380px 0}
+.o2k7Skin span.mce_help {background-position:-340px 0}
+.o2k7Skin span.mce_code {background-position:-260px 0}
+.o2k7Skin span.mce_hr {background-position:-360px 0}
+.o2k7Skin span.mce_visualaid {background-position:-660px 0}
+.o2k7Skin span.mce_charmap {background-position:-240px 0}
+.o2k7Skin span.mce_paste {background-position:-560px 0}
+.o2k7Skin span.mce_copy {background-position:-700px 0}
+.o2k7Skin span.mce_cut {background-position:-680px 0}
+.o2k7Skin span.mce_blockquote {background-position:-220px 0}
+.o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0}
+.o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0}
+.o2k7Skin .mce_forecolorpicker {background-position:-720px 0}
+.o2k7Skin .mce_backcolorpicker {background-position:-760px 0}
+
+/* Plugins */
+.o2k7Skin span.mce_advhr {background-position:-0px -20px}
+.o2k7Skin span.mce_ltr {background-position:-20px -20px}
+.o2k7Skin span.mce_rtl {background-position:-40px -20px}
+.o2k7Skin span.mce_emotions {background-position:-60px -20px}
+.o2k7Skin span.mce_fullpage {background-position:-80px -20px}
+.o2k7Skin span.mce_fullscreen {background-position:-100px -20px}
+.o2k7Skin span.mce_iespell {background-position:-120px -20px}
+.o2k7Skin span.mce_insertdate {background-position:-140px -20px}
+.o2k7Skin span.mce_inserttime {background-position:-160px -20px}
+.o2k7Skin span.mce_absolute {background-position:-180px -20px}
+.o2k7Skin span.mce_backward {background-position:-200px -20px}
+.o2k7Skin span.mce_forward {background-position:-220px -20px}
+.o2k7Skin span.mce_insert_layer {background-position:-240px -20px}
+.o2k7Skin span.mce_insertlayer {background-position:-260px -20px}
+.o2k7Skin span.mce_movebackward {background-position:-280px -20px}
+.o2k7Skin span.mce_moveforward {background-position:-300px -20px}
+.o2k7Skin span.mce_media {background-position:-320px -20px}
+.o2k7Skin span.mce_nonbreaking {background-position:-340px -20px}
+.o2k7Skin span.mce_pastetext {background-position:-360px -20px}
+.o2k7Skin span.mce_pasteword {background-position:-380px -20px}
+.o2k7Skin span.mce_selectall {background-position:-400px -20px}
+.o2k7Skin span.mce_preview {background-position:-420px -20px}
+.o2k7Skin span.mce_print {background-position:-440px -20px}
+.o2k7Skin span.mce_cancel {background-position:-460px -20px}
+.o2k7Skin span.mce_save {background-position:-480px -20px}
+.o2k7Skin span.mce_replace {background-position:-500px -20px}
+.o2k7Skin span.mce_search {background-position:-520px -20px}
+.o2k7Skin span.mce_styleprops {background-position:-560px -20px}
+.o2k7Skin span.mce_table {background-position:-580px -20px}
+.o2k7Skin span.mce_cell_props {background-position:-600px -20px}
+.o2k7Skin span.mce_delete_table {background-position:-620px -20px}
+.o2k7Skin span.mce_delete_col {background-position:-640px -20px}
+.o2k7Skin span.mce_delete_row {background-position:-660px -20px}
+.o2k7Skin span.mce_col_after {background-position:-680px -20px}
+.o2k7Skin span.mce_col_before {background-position:-700px -20px}
+.o2k7Skin span.mce_row_after {background-position:-720px -20px}
+.o2k7Skin span.mce_row_before {background-position:-740px -20px}
+.o2k7Skin span.mce_merge_cells {background-position:-760px -20px}
+.o2k7Skin span.mce_table_props {background-position:-980px -20px}
+.o2k7Skin span.mce_row_props {background-position:-780px -20px}
+.o2k7Skin span.mce_split_cells {background-position:-800px -20px}
+.o2k7Skin span.mce_template {background-position:-820px -20px}
+.o2k7Skin span.mce_visualchars {background-position:-840px -20px}
+.o2k7Skin span.mce_abbr {background-position:-860px -20px}
+.o2k7Skin span.mce_acronym {background-position:-880px -20px}
+.o2k7Skin span.mce_attribs {background-position:-900px -20px}
+.o2k7Skin span.mce_cite {background-position:-920px -20px}
+.o2k7Skin span.mce_del {background-position:-940px -20px}
+.o2k7Skin span.mce_ins {background-position:-960px -20px}
+.o2k7Skin span.mce_pagebreak {background-position:0 -40px}
+.o2k7Skin .mce_spellchecker span.mceAction {background-position:-540px -20px}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css
new file mode 100644
index 0000000..caa7dbb
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css
@@ -0,0 +1,8 @@
+/* Black */
+.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton span.mceOpen, .o2k7SkinBlack .mceListBox .mceOpen {background-image:url(img/button_bg_black.png)}
+.o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}
+.o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}
+.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}
+.o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;}
+.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)}
+.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#FFE7A1} \ No newline at end of file
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css
new file mode 100644
index 0000000..bf3c479
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css
@@ -0,0 +1,5 @@
+/* Silver */
+.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton span.mceOpen, .o2k7SkinSilver .mceListBox .mceOpen {background-image:url(img/button_bg_silver.png)}
+.o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}
+.o2k7SkinSilver .mceListBox .mceText {background:#FFF}
+.o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
new file mode 100644
index 0000000..3ad3e01
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
@@ -0,0 +1,19 @@
+body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px; }
+body.mceContentBody {background:#FFF; color:#000;}
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;}
+a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
+img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
+img {border:0;}
+
+/* IE
+* html body {
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+}
+*/ \ No newline at end of file
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css
new file mode 100644
index 0000000..7df59cd
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css
@@ -0,0 +1,119 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+/*scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;*/
+background:#eaf3ea;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#eaf3ea;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.mceButton, .updateButton {
+border: 1px solid #bbb;
+margin:0;
+padding:0 0 1px;
+font-weight:bold;
+font-size: 11px;
+width:94px;
+height:24px;
+background:url(img/fade-butt.png) 0 0;
+cursor:pointer;
+}
+#insert:hover, #cancel:hover, input.mceButton:hover, .updateButton:hover,
+#insert:focus, #cancel:focus, input.mceButton:focus, .updateButton:focus {
+border: 1px solid #555;
+}
+
+/* Browse */
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+#charmap #charmapView {background-color:#fff;}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;} \ No newline at end of file
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png
new file mode 100644
index 0000000..df90439
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png
new file mode 100644
index 0000000..12cfb41
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif
new file mode 100644
index 0000000..687b241
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png
new file mode 100644
index 0000000..42f08b7
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/separator.gif b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif
index 4f39b80..4f39b80 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/separator.gif
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif
new file mode 100644
index 0000000..ce4be63
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
new file mode 100644
index 0000000..9106dfb
--- /dev/null
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
@@ -0,0 +1,370 @@
+/* Reset */
+.wp_themeSkin table, .wp_themeSkin tbody, .wp_themeSkin a, .wp_themeSkin img, .wp_themeSkin tr, .wp_themeSkin div, .wp_themeSkin td, .wp_themeSkin iframe, .wp_themeSkin span, .wp_themeSkin *, .wp_themeSkin .mceText {
+border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; vertical-align:baseline; width:auto; border-collapse:separate;
+}
+.wp_themeSkin a:hover, .wp_themeSkin a:link, .wp_themeSkin a:visited, .wp_themeSkin a:active {text-decoration:none; font-weight:normal; cursor:default;}
+.wp_themeSkin table td {vertical-align:middle}
+
+/* Containers */
+.wp_themeSkin table {}
+.wp_themeSkin iframe {display:block;}
+.wp_themeSkin .mceToolbar {padding: 2px;}
+
+/* External */
+.wp_themeSkin .mceExternalToolbar {position:absolute; border-bottom:0; display:none}
+.wp_themeSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
+.wp_themeSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
+
+/* Layout */
+.wp_themeSkin table.mceToolbar, .wp_themeSkin tr.mceFirst .mceToolbar tr td, .wp_themeSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
+.wp_themeSkin table.mceLayout {border:0;}
+.wp_themeSkin .mceIframeContainer {}
+.wp_themeSkin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible;height:20px;}
+.wp_themeSkin .mceStatusbar div {float:left; padding:2px;}
+.wp_themeSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.wp_themeSkin .mceStatusbar a:hover {text-decoration:underline}
+.wp_themeSkin table.mceToolbar {margin: 0 2px 2px;}
+.wp_themeSkin #content_toolbar1 {margin-top: 2px;}
+.wp_themeSkin .mceToolbar .mceToolbarEndListBox span {display:none}
+.wp_themeSkin span.mceIcon, .wp_themeSkin img.mceIcon {display:block; width:20px; height:20px}
+.wp_themeSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
+
+/* Button */
+.wp_themeSkin .mceButton {
+ display:block;
+ width: 20px;
+ height: 20px;
+ cursor: default;
+ padding: 1px 2px;
+ margin: 1px;
+ background-image: url(img/butt2.png);
+ background-position: 2px 1px;
+ background-repeat: no-repeat;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ border-radius: 3px;
+}
+.wp_themeSkin a.mceButton span, .wp_themeSkin a.mceButton img {}
+.wp_themeSkin .mceOldBoxModel a.mceButton span, .wp_themeSkin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
+.wp_themeSkin a.mceButtonEnabled:hover {
+ background-position:0 -20px;
+}
+.wp_themeSkin a.mceButtonActive, .wp_themeSkin a.mceButtonSelected {
+ background-position:0 -20px;
+}
+.wp_themeSkin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30);}
+.wp_themeSkin .mceButtonDisabled {}
+
+/* Separator */
+.wp_themeSkin .mceSeparator {
+ height: 24px;
+ width: 1px;
+ display: block;
+ background: transparent;
+ overflow: hidden;
+ margin: 0 2px;
+}
+
+/* ListBox */
+.wp_themeSkin .mceListBox, .wp_themeSkin .mceListBox a {display:block}
+.wp_themeSkin .mceListBox .mceText {
+ padding: 1px 2px 1px 5px;
+ text-align:left;
+ text-decoration: none !important;
+ width:70px;
+ background-image: url(img/butt2.png);
+ background-position: 1px 1px;
+ background-repeat: repeat-x;
+ font-family: Tahoma,Verdana,Arial,Helvetica;
+ font-size: 11px;
+ height: 20px;
+ line-height: 20px;
+ overflow: hidden;
+}
+.wp_themeSkin .mceListBox {
+ margin: 1px;
+ direction: ltr;
+}
+.wp_themeSkin .mceListBox .mceOpen {
+ width: 14px;
+ height: 20px;
+ border-collapse: separate;
+ background-image: url(img/butt2.png);
+ background-position: 1px 1px;
+ background-repeat: repeat-x;
+ padding: 1px;
+ border-left: 0 none !important;
+}
+.wp_themeSkin .mceListBox .mceOpen span {
+ display: block;
+ width:14px;
+ height:20px;
+ background-image: url(img/down_arrow.gif);
+ background-position: 2px 1px;
+ background-repeat: no-repeat;
+}
+.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
+.wp_themeSkin .mceListBoxHover .mceText,
+.wp_themeSkin .mceListBoxSelected .mceText,
+.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
+.wp_themeSkin .mceListBoxHover .mceOpen,
+.wp_themeSkin .mceListBoxSelected .mceOpen {
+ background-image: none;
+}
+.wp_themeSkin .mceListBoxDisabled .mceText {color:gray}
+.wp_themeSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
+.wp_themeSkin .mceOldBoxModel .mceListBox .mceText {height:22px}
+.wp_themeSkin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px;}
+
+/* SplitButton */
+.wp_themeSkin .mceSplitButton a, .wp_themeSkin .mceSplitButton span {display:block; height:20px}
+.wp_themeSkin .mceSplitButton {
+ display:block;
+ margin: 1px;
+ direction: ltr;
+}
+.wp_themeSkin table.mceSplitButton td {
+ padding: 2px;
+}
+.wp_themeSkin .mceSplitButton a.mceAction {
+ height:20px;
+ width:20px;
+ background-image: url(img/butt2.png);
+ background-position: 1px 1px;
+ background-repeat: repeat-x;
+ padding: 1px 2px;
+}
+.wp_themeSkin .mceSplitButton span.mceAction {
+ background: url(../../img/icons.gif) 20px 20px;
+ width:20px;
+}
+.wp_themeSkin .mceSplitButton a.mceOpen {
+ width:10px;
+ height:20px;
+ border-collapse:separate;
+ background-image: url(img/butt2.png);
+ background-position: 1px 1px;
+ background-repeat: repeat-x;
+ padding: 1px;
+ border-left: 0 none !important;
+}
+.wp_themeSkin .mceSplitButton span.mceOpen {
+ width:10px;
+ background-image: url(img/down_arrow.gif);
+ background-position: 0px 1px;
+ background-repeat: no-repeat;
+ border-collapse:separate;
+ border-left: 0 none !important;
+}
+.wp_themeSkin .mceSplitButton a.mceOpen:hover,
+.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
+.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceAction:hover {
+ background-image: none;
+}
+.wp_themeSkin table.mceSplitButtonEnabled:hover span.mceOpen,
+.wp_themeSkin .mceSplitButtonHover span.mceOpen,
+.wp_themeSkin .mceSplitButtonSelected span.mceOpen {
+}
+.wp_themeSkin .mceSplitButtonDisabled .mceAction {
+ opacity:0.3; filter:alpha(opacity=30);
+}
+.wp_themeSkin .mceListBox a.mceText, .wp_themeSkin .mceSplitButton a.mceAction {
+ -moz-border-radius-bottomleft: 3px;
+ -webkit-border-bottom-left-radius: 3px;
+ -khtml-border-bottom-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ -moz-border-radius-topleft: 3px;
+ -webkit-border-top-left-radius: 3px;
+ -khtml-border-top-left-radius: 3px;
+ border-top-left-radius: 3px;
+}
+.wp_themeSkin .mceSplitButton a.mceOpen, .wp_themeSkin .mceListBox a.mceOpen {
+ -moz-border-radius-bottomright: 3px;
+ -webkit-border-bottom-right-radius: 3px;
+ -khtml-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ -moz-border-radius-topright: 3px;
+ -webkit-border-top-right-radius: 3px;
+ -khtml-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+}
+
+/* ColorSplitButton */
+.wp_themeSkin div.mceColorSplitMenu table {}
+.wp_themeSkin .mceColorSplitMenu td {padding:2px}
+.wp_themeSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden;}
+.wp_themeSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px;}
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {}
+.wp_themeSkin a.mceMoreColors:hover {}
+.wp_themeSkin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden}
+
+/* Menu */
+.wp_themeSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000;}
+.wp_themeSkin .mceNoIcons span.mceIcon {width:0;}
+.wp_themeSkin .mceNoIcons a .mceText {padding-left:10px}
+.wp_themeSkin .mceMenu table {}
+.wp_themeSkin .mceMenu a, .wp_themeSkin .mceMenu span, .wp_themeSkin .mceMenu {display:block}
+.wp_themeSkin .mceMenu td {height:20px;overflow:hidden;}
+.wp_themeSkin .mceMenu a {
+ position:relative;
+ padding:3px 0 4px 0;
+ text-decoration: none !important;
+}
+.wp_themeSkin .mceMenu .mceText {
+ position:relative;
+ display:block;
+ font-family:Tahoma,Verdana,Arial,Helvetica;
+ cursor:default;
+ margin:0;
+ padding:0 25px;
+}
+.wp_themeSkin .mceMenu span.mceText, .wp_themeSkin .mceMenu .mcePreview {font-size:11px}
+.wp_themeSkin .mceMenu pre.mceText {font-family:Monospace}
+.wp_themeSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
+.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
+.wp_themeSkin .mceMenu .mceMenuItemActive {}
+.wp_themeSkin td.mceMenuItemSeparator {height:1px}
+.wp_themeSkin .mceMenuItemTitle a {
+ border-top: 0;
+ border-right: 0;
+ border-left: 0;
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ text-decoration: none !important;
+}
+.wp_themeSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px}
+.wp_themeSkin .mceMenuItemDisabled .mceText {}
+.wp_themeSkin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)}
+.wp_themeSkin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center}
+.wp_themeSkin .mceMenu span.mceMenuLine {display:none}
+.wp_themeSkin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}
+
+/* Progress,Resize */
+.wp_themeSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF}
+.wp_themeSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
+.wp_themeSkin .mcePlaceHolder {border:1px dotted gray}
+
+/* Theme */
+.wp_themeSkin span.mce_bold {background-position:0 0}
+.wp_themeSkin span.mce_italic {background-position:-60px 0}
+.wp_themeSkin span.mce_underline {background-position:-140px 0}
+.wp_themeSkin span.mce_strikethrough {background-position:-120px 0}
+.wp_themeSkin span.mce_undo {background-position:-160px 0}
+.wp_themeSkin span.mce_redo {background-position:-100px 0}
+.wp_themeSkin span.mce_cleanup {background-position:-40px 0}
+.wp_themeSkin span.mce_bullist {background-position:-20px 0}
+.wp_themeSkin span.mce_numlist {background-position:-80px 0}
+.wp_themeSkin span.mce_justifyleft {background-position:-460px 0}
+.wp_themeSkin span.mce_justifyright {background-position:-480px 0}
+.wp_themeSkin span.mce_justifycenter {background-position:-420px 0}
+.wp_themeSkin span.mce_justifyfull {background-position:-440px 0}
+.wp_themeSkin span.mce_anchor {background-position:-200px 0}
+.wp_themeSkin span.mce_indent {background-position:-400px 0}
+.wp_themeSkin span.mce_outdent {background-position:-540px 0}
+.wp_themeSkin span.mce_link {background-position:-500px 0}
+.wp_themeSkin span.mce_unlink {background-position:-640px 0}
+.wp_themeSkin span.mce_sub {background-position:-600px 0}
+.wp_themeSkin span.mce_sup {background-position:-620px 0}
+.wp_themeSkin span.mce_removeformat {background-position:-580px 0}
+.wp_themeSkin span.mce_newdocument {background-position:-520px 0}
+.wp_themeSkin span.mce_image {background-position:-380px 0}
+.wp_themeSkin span.mce_help {background-position:-340px 0}
+.wp_themeSkin span.mce_code {background-position:-260px 0}
+.wp_themeSkin span.mce_hr {background-position:-360px 0}
+.wp_themeSkin span.mce_visualaid {background-position:-660px 0}
+.wp_themeSkin span.mce_charmap {background-position:-240px 0}
+.wp_themeSkin span.mce_paste {background-position:-560px 0}
+.wp_themeSkin span.mce_copy {background-position:-700px 0}
+.wp_themeSkin span.mce_cut {background-position:-680px 0}
+.wp_themeSkin span.mce_blockquote {background-position:-220px 0}
+.wp_themeSkin .mce_forecolor span.mceAction {background-position:-720px 0}
+.wp_themeSkin .mce_backcolor span.mceAction {background-position:-760px 0}
+.wp_themeSkin .mce_forecolorpicker {background-position:-720px 0}
+.wp_themeSkin .mce_backcolorpicker {background-position:-760px 0}
+
+/* Plugins */
+.wp_themeSkin span.mce_advhr {background-position:-0px -20px}
+.wp_themeSkin span.mce_ltr {background-position:-20px -20px}
+.wp_themeSkin span.mce_rtl {background-position:-40px -20px}
+.wp_themeSkin span.mce_emotions {background-position:-60px -20px}
+.wp_themeSkin span.mce_fullpage {background-position:-80px -20px}
+.wp_themeSkin span.mce_fullscreen {background-position:-100px -20px}
+.wp_themeSkin span.mce_iespell {background-position:-120px -20px}
+.wp_themeSkin span.mce_insertdate {background-position:-140px -20px}
+.wp_themeSkin span.mce_inserttime {background-position:-160px -20px}
+.wp_themeSkin span.mce_absolute {background-position:-180px -20px}
+.wp_themeSkin span.mce_backward {background-position:-200px -20px}
+.wp_themeSkin span.mce_forward {background-position:-220px -20px}
+.wp_themeSkin span.mce_insert_layer {background-position:-240px -20px}
+.wp_themeSkin span.mce_insertlayer {background-position:-260px -20px}
+.wp_themeSkin span.mce_movebackward {background-position:-280px -20px}
+.wp_themeSkin span.mce_moveforward {background-position:-300px -20px}
+.wp_themeSkin span.mce_media {background-position:-320px -20px}
+.wp_themeSkin span.mce_nonbreaking {background-position:-340px -20px}
+.wp_themeSkin span.mce_pastetext {background-position:-360px -20px}
+.wp_themeSkin span.mce_pasteword {background-position:-380px -20px}
+.wp_themeSkin span.mce_selectall {background-position:-400px -20px}
+.wp_themeSkin span.mce_preview {background-position:-420px -20px}
+.wp_themeSkin span.mce_print {background-position:-440px -20px}
+.wp_themeSkin span.mce_cancel {background-position:-460px -20px}
+.wp_themeSkin span.mce_save {background-position:-480px -20px}
+.wp_themeSkin span.mce_replace {background-position:-500px -20px}
+.wp_themeSkin span.mce_search {background-position:-520px -20px}
+.wp_themeSkin span.mce_styleprops {background-position:-560px -20px}
+.wp_themeSkin span.mce_table {background-position:-580px -20px}
+.wp_themeSkin span.mce_cell_props {background-position:-600px -20px}
+.wp_themeSkin span.mce_delete_table {background-position:-620px -20px}
+.wp_themeSkin span.mce_delete_col {background-position:-640px -20px}
+.wp_themeSkin span.mce_delete_row {background-position:-660px -20px}
+.wp_themeSkin span.mce_col_after {background-position:-680px -20px}
+.wp_themeSkin span.mce_col_before {background-position:-700px -20px}
+.wp_themeSkin span.mce_row_after {background-position:-720px -20px}
+.wp_themeSkin span.mce_row_before {background-position:-740px -20px}
+.wp_themeSkin span.mce_merge_cells {background-position:-760px -20px}
+.wp_themeSkin span.mce_table_props {background-position:-980px -20px}
+.wp_themeSkin span.mce_row_props {background-position:-780px -20px}
+.wp_themeSkin span.mce_split_cells {background-position:-800px -20px}
+.wp_themeSkin span.mce_template {background-position:-820px -20px}
+.wp_themeSkin span.mce_visualchars {background-position:-840px -20px}
+.wp_themeSkin span.mce_abbr {background-position:-860px -20px}
+.wp_themeSkin span.mce_acronym {background-position:-880px -20px}
+.wp_themeSkin span.mce_attribs {background-position:-900px -20px}
+.wp_themeSkin span.mce_cite {background-position:-920px -20px}
+.wp_themeSkin span.mce_del {background-position:-940px -20px}
+.wp_themeSkin span.mce_ins {background-position:-960px -20px}
+.wp_themeSkin span.mce_pagebreak {background-position:0 -40px}
+.wp_themeSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
+
+/* border */
+.wp_themeSkin .mceExternalToolbar,
+.wp_themeSkin .mceButton,
+.wp_themeSkin a.mceButtonEnabled:hover,
+.wp_themeSkin a.mceButtonActive,
+.wp_themeSkin a.mceButtonSelected,
+.wp_themeSkin .mceListBox .mceText,
+.wp_themeSkin .mceListBox .mceOpen,
+.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
+.wp_themeSkin .mceListBoxHover .mceText,
+.wp_themeSkin .mceListBoxSelected .mceText,
+.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
+.wp_themeSkin .mceListBoxHover .mceOpen,
+.wp_themeSkin .mceListBoxSelected .mceOpen,
+.wp_themeSkin select.mceListBox,
+.wp_themeSkin .mceSplitButton a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceOpen,
+.wp_themeSkin .mceSplitButton a.mceOpen:hover,
+.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
+.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
+.wp_themeSkin .mceSplitButton a.mceAction:hover,
+.wp_themeSkin div.mceColorSplitMenu table,
+.wp_themeSkin .mceColorSplitMenu a,
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors,
+.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover,
+.wp_themeSkin a.mceMoreColors:hover,
+.wp_themeSkin .mceMenu {
+ border-style: solid;
+ border-width: 1px;
+}
diff --git a/wp-includes/js/tinymce/tiny_mce_ext.js b/wp-includes/js/tinymce/tiny_mce_ext.js
new file mode 100644
index 0000000..ccea485
--- /dev/null
+++ b/wp-includes/js/tinymce/tiny_mce_ext.js
@@ -0,0 +1,29 @@
+tinyMCEPreInit.start = function() {
+ var t = this, each = tinymce.each, s = t.settings, sl = tinymce.ScriptLoader, ln = s.languages, th = s.themes;
+
+ function load(u, sp) {
+ var o;
+
+ if (!sp)
+ u = t.base + u;
+
+ o = {url : u, state : 2};
+ sl.queue.push(o);
+ sl.lookup[o.url] = o;
+ };
+
+ sl.markDone(t.base + '/langs/' + ln + '.js');
+
+ load('/themes/' + th + '/editor_template' + t.suffix + '.js');
+ sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '.js');
+ sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '_dlg.js');
+
+ each(s.plugins.split(','), function(n) {
+ if (n && n.charAt(0) != '-') {
+ load('/plugins/' + n + '/editor_plugin' + t.suffix + '.js');
+
+ sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '.js');
+ sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '_dlg.js');
+ }
+ });
+};
diff --git a/wp-includes/js/tinymce/wordpress.css b/wp-includes/js/tinymce/wordpress.css
new file mode 100644
index 0000000..07da9ef
--- /dev/null
+++ b/wp-includes/js/tinymce/wordpress.css
@@ -0,0 +1,29 @@
+/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
+
+body.mceContentBody {
+ background: #fff;
+ color: #000;
+ font: 13px/19px "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
+ padding: .2em;
+}
+
+td {
+ font-size: 10px;
+}
+
+pre {
+ font: 12px/18px "Courier New", monospace;
+}
+
+.mceVisualAid {
+ border: 1px dashed #BBBBBB !important;
+}
+
+.mceItemAnchor {
+ width: 12px;
+ line-height: 6px;
+ overflow: hidden;
+ padding-left: 12px;
+ background-position: bottom;
+ background-repeat: no-repeat;
+}
diff --git a/wp-includes/js/wp-ajax-response.js b/wp-includes/js/wp-ajax-response.js
new file mode 100644
index 0000000..4197773
--- /dev/null
+++ b/wp-includes/js/wp-ajax-response.js
@@ -0,0 +1,57 @@
+wpAjax = jQuery.extend( {
+ unserialize: function( s ) {
+ var r = {}; if ( !s ) { return r; }
+ var q = s.split('?'); if ( q[1] ) { s = q[1]; }
+ var pp = s.split('&');
+ for ( var i in pp ) {
+ if ( jQuery.isFunction(pp.hasOwnProperty) && !pp.hasOwnProperty(i) ) { continue; }
+ var p = pp[i].split('=');
+ r[p[0]] = p[1];
+ }
+ return r;
+ },
+ parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission
+ var parsed = {};
+ var re = jQuery('#' + r).html('');
+ if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) {
+ parsed.responses = [];
+ parsed.errors = false;
+ var err = '';
+ jQuery('response', x).each( function() {
+ var th = jQuery(this);
+ var child = jQuery(this.firstChild);
+ var response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
+ response.data = jQuery( 'response_data', child ).text();
+ response.supplemental = {};
+ if ( !jQuery( 'supplemental', child ).children().each( function() {
+ response.supplemental[this.nodeName] = jQuery(this).text();
+ } ).size() ) { response.supplemental = false }
+ response.errors = [];
+ if ( !jQuery('wp_error', child).each( function() {
+ var code = jQuery(this).attr('code');
+ var anError = { code: code, message: this.firstChild.nodeValue, data: false };
+ var errorData = jQuery('wp_error_data[code="' + code + '"]', x);
+ if ( errorData ) { anError.data = errorData.get(); }
+ var formField = jQuery( 'form-field', errorData ).text();
+ if ( formField ) { code = formField; }
+ if ( e ) { wpAjax.invalidateForm( jQuery('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); }
+ err += '<p>' + anError.message + '</p>';
+ response.errors.push( anError );
+ parsed.errors = true;
+ } ).size() ) { response.errors = false; }
+ parsed.responses.push( response );
+ } );
+ if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
+ return parsed;
+ }
+ if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
+ x = parseInt(x,10);
+ if ( -1 == x ) { return !re.html('<div class="error"><p>' + this.noPerm + '</p></div>'); }
+ else if ( 0 === x ) { return !re.html('<div class="error"><p>' + this.broken + '</p></div>'); }
+ return true;
+ },
+ validateForm: function( selector ) {
+ selector = jQuery( selector );
+ return !selector.find('.form-required').andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]').addClass( 'form-invalid' ).change( function() { jQuery(this).removeClass( 'form-invalid' ); } ).size();
+ }
+}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'AJAX is teh b0rked.' } );
diff --git a/wp-includes/js/wp-lists.js b/wp-includes/js/wp-lists.js
new file mode 100644
index 0000000..e0c5b25
--- /dev/null
+++ b/wp-includes/js/wp-lists.js
@@ -0,0 +1,369 @@
+(function($) {
+var currentFormEl = false;
+var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'};
+
+var wpList = {
+ settings: {
+ url: wpListL10n.url, type: 'POST',
+ response: 'ajax-response',
+
+ what: '',
+ alt: 'alternate', altOffset: 0,
+ addColor: null, delColor: null, dimAddColor: null, dimDelColor: null,
+
+ confirm: null,
+ addBefore: null, addAfter: null,
+ delBefore: null, delAfter: null,
+ dimBefore: null, dimAfter: null
+ },
+
+ nonce: function(e,s) {
+ var url = wpAjax.unserialize(e.attr('href'));
+ return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0;
+ },
+
+ parseClass: function(e,t) {
+ var c = [], cl;
+ try {
+ cl = $(e).attr('class') || '';
+ cl = cl.match(new RegExp(t+':[A-Za-z0-9:_=-]+'));
+ if ( cl ) { c = cl[0].split(':'); }
+ } catch(r) {}
+ return c;
+ },
+
+ pre: function(e,s,a) {
+ var bg; var r;
+ s = $.extend( {}, this.wpList.settings, {
+ element: null,
+ nonce: 0
+ }, s || {} );
+ if ( $.isFunction( s.confirm ) ) {
+ if ( 'add' != a ) {
+ bg = $('#' + s.element).css('backgroundColor');
+ $('#' + s.element).css('backgroundColor', '#FF9966');
+ }
+ r = s.confirm.call(this,e,s,a,bg);
+ if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); }
+ if ( !r ) { return false; }
+ }
+ return s;
+ },
+
+ ajaxAdd: function( e, s ) {
+ var list = this; e = $(e); s = s || {};
+ var cls = wpList.parseClass(e,'add');
+ s = wpList.pre.call( list, e, s, 'add' );
+
+ s.element = cls[2] || e.attr( 'id' ) || s.element || null;
+ if ( cls[3] ) { s.addColor = '#' + cls[3]; }
+ else { s.addColor = s.addColor || '#FFFF33'; }
+
+ if ( !s ) { return false; }
+
+ if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); }
+
+ if ( !s.element ) { return true; }
+
+ s.action = 'add-' + s.what;
+
+ s.nonce = wpList.nonce(e,s);
+
+ var es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]');
+ var valid = wpAjax.validateForm( '#' + s.element );
+ if ( !valid ) { return false; }
+
+ s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) );
+ var formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
+ if ( formData ) { s.data += '&' + formData; }
+
+ if ( $.isFunction(s.addBefore) ) {
+ s = s.addBefore( s );
+ if ( !s ) { return true; }
+ }
+ if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; }
+
+ s.success = function(r) {
+ var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
+ if ( !res || res.errors ) { return false; }
+
+ jQuery.each( res.responses, function() {
+ wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
+ pos: this.position || 0,
+ id: this.id || 0,
+ oldId: this.oldId || null
+ } ) );
+ } );
+
+ if ( $.isFunction(s.addAfter) ) {
+ var o = this.complete;
+ this.complete = function(x,st) {
+ var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+ s.addAfter( r, _s );
+ if ( $.isFunction(o) ) { o(x,st); }
+ };
+ }
+ list.wpList.recolor();
+ wpList.clear.call(list,'#' + s.element);
+ };
+
+ $.ajax( s );
+ return false;
+ },
+
+ ajaxDel: function( e, s ) {
+ var list = this; e = $(e); s = s || {};
+ var cls = wpList.parseClass(e,'delete');
+ s = wpList.pre.call( list, e, s, 'delete' );
+
+ s.element = cls[2] || s.element || null;
+ if ( cls[3] ) { s.delColor = '#' + cls[3]; }
+ else { s.delColor = s.delColor || '#FF3333'; }
+
+ if ( !s || !s.element ) { return false; }
+
+ s.action = 'delete-' + s.what;
+
+ s.nonce = wpList.nonce(e,s);
+
+ s.data = $.extend(
+ { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
+ wpAjax.unserialize( cls[4] || '' )
+ );
+
+ if ( $.isFunction(s.delBefore) ) {
+ s = s.delBefore( s );
+ if ( !s ) { return true; }
+ }
+ if ( !s.data._ajax_nonce ) { return true; }
+
+ var element = $('#' + s.element);
+
+ if ( 'none' != s.delColor ) {
+ var anim = 'slideUp';
+ if ( element.css( 'display' ).match(/table/) )
+ anim = 'fadeOut'; // Can't slideup table rows and other table elements. Known jQuery bug
+ element
+ .animate( { backgroundColor: s.delColor }, 'fast' )[anim]( 'fast' )
+ .queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+ } else {
+ list.wpList.recolor();
+ }
+
+ s.success = function(r) {
+ var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
+ if ( !res || res.errors ) {
+ element.stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+ return false;
+ }
+ if ( $.isFunction(s.delAfter) ) {
+ var o = this.complete;
+ this.complete = function(x,st) {
+ element.queue( function() {
+ var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+ s.delAfter( r, _s );
+ if ( $.isFunction(o) ) { o(x,st); }
+ } ).dequeue();
+ };
+ }
+ };
+ $.ajax( s );
+ return false;
+ },
+
+ ajaxDim: function( e, s ) {
+ var list = this; e = $(e); s = s || {};
+ var cls = wpList.parseClass(e,'dim');
+ s = wpList.pre.call( list, e, s, 'dim' );
+
+ s.element = cls[2] || s.element || null;
+ s.dimClass = cls[3] || s.dimClass || null;
+ if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; }
+ else { s.dimAddColor = s.dimAddColor || '#FFFF33'; }
+ if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; }
+ else { s.dimDelColor = s.dimDelColor || '#FF3333'; }
+
+ if ( !s || !s.element || !s.dimClass ) { return true; }
+
+ s.action = 'dim-' + s.what;
+
+ s.nonce = wpList.nonce(e,s);
+
+ s.data = $.extend(
+ { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
+ wpAjax.unserialize( cls[6] || '' )
+ );
+
+ if ( $.isFunction(s.dimBefore) ) {
+ s = s.dimBefore( s );
+ if ( !s ) { return true; }
+ }
+
+ var element = $('#' + s.element);
+ var isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
+ var color = wpList.getColor( element );
+ element.toggleClass( s.dimClass )
+ var dimColor = isClass ? s.dimAddColor : s.dimDelColor;
+ if ( 'none' != dimColor ) {
+ element
+ .animate( { backgroundColor: dimColor }, 'fast' )
+ .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
+ .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+ }
+
+ if ( !s.data._ajax_nonce ) { return true; }
+
+ s.success = function(r) {
+ var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
+ if ( !res || res.errors ) {
+ element.stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+ return false;
+ }
+ if ( $.isFunction(s.dimAfter) ) {
+ var o = this.complete;
+ this.complete = function(x,st) {
+ element.queue( function() {
+ var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+ s.dimAfter( r, _s );
+ if ( $.isFunction(o) ) { o(x,st); }
+ } ).dequeue();
+ };
+ }
+ };
+
+ $.ajax( s );
+ return false;
+ },
+
+ // From jquery.color.js: jQuery Color Animation by John Resig
+ getColor: function( el ) {
+ if ( el.constructor == Object )
+ el = el.get(0);
+ var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
+ do {
+ color = jQuery.curCSS(elem, 'backgroundColor');
+ if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
+ break;
+ } while ( elem = elem.parentNode );
+ return color || '#ffffff';
+ },
+
+ add: function( e, s ) {
+ var list = $(this);
+ e = $(e);
+
+ var old = false;
+ var _s = { pos: 0, id: 0, oldId: null };
+ if ( 'string' == typeof s ) { s = { what: s }; }
+ s = $.extend(_s, this.wpList.settings, s);
+ if ( !e.size() || !s.what ) { return false; }
+ if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); }
+ if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); }
+
+ if ( old && old.size() ) {
+ old.replaceWith(e);
+ } else if ( isNaN(s.pos) ) {
+ var ba = 'after';
+ if ( '-' == s.pos.substr(0,1) ) {
+ s.pos = s.pos.substr(1);
+ ba = 'before';
+ }
+ var ref = list.find( '#' + s.pos );
+ if ( 1 === ref.size() ) { ref[ba](e); }
+ else { list.append(e); }
+ } else if ( s.pos < 0 ) {
+ list.prepend(e);
+ } else {
+ list.append(e);
+ }
+
+ if ( s.alt ) {
+ if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); }
+ else { e.addClass( s.alt ); }
+ }
+
+ if ( 'none' != s.addColor ) {
+ var color = wpList.getColor( e );
+ e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+ }
+ list.each( function() { this.wpList.process( e ); } );
+ return e;
+ },
+
+ clear: function(e) {
+ var list = this;
+ e = $(e);
+ if ( list.wpList && e.parents( '#' + list.id ).size() ) { return; }
+ e.find(':input').each( function() {
+ if ( $(this).parents('.form-no-clear').size() )
+ return;
+ var t = this.type.toLowerCase(); var tag = this.tagName.toLowerCase();
+ if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; }
+ else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; }
+ else if ( 'select' == tag ) { this.selectedIndex = null; }
+ });
+ },
+
+ process: function(el) {
+ var list = this;
+ $("[class^=add:" + list.id + ":]", el || null)
+ .filter('form').submit( function() { return list.wpList.add(this); } ).end()
+ .not('form').click( function() { return list.wpList.add(this); } ).each( function() {
+ var addEl = this;
+ var c = wpList.parseClass(this,'add')[2] || addEl.id;
+ if ( !c ) { return; }
+ var forms = []; var ins = [];
+ $('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() {
+ ins.push(this);
+ $.merge(forms,$(this).parents('form'));
+ forms = $.unique(forms);
+ } );
+ $(forms).submit( function() {
+ if ( 0 <= $.inArray(currentFormEl,ins) ) {
+ $(addEl).trigger( 'click' );
+ $(currentFormEl).focus();
+ return false;
+ }
+ } );
+ } );
+ $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } );
+ $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } );
+ },
+
+ recolor: function() {
+ var list = this;
+ if ( !list.wpList.settings.alt ) { return; }
+ var items = $('.list-item:visible', list);
+ if ( !items.size() ) { items = $(list).children(':visible'); }
+ var eo = [':even',':odd'];
+ if ( list.wpList.settings.altOffset % 2 ) { eo.reverse(); }
+ items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt);
+ },
+
+ init: function() {
+ var lists = this;
+ lists.wpList.process = function(a) {
+ lists.each( function() {
+ this.wpList.process(a);
+ } );
+ };
+ lists.wpList.recolor = function() {
+ lists.each( function() {
+ this.wpList.recolor();
+ } );
+ };
+ }
+};
+
+$.fn.wpList = function( settings ) {
+ this.each( function() {
+ var _this = this;
+ this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) };
+ $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } );
+ } );
+ wpList.init.call(this);
+ this.wpList.process();
+ return this;
+};
+
+})(jQuery);
diff --git a/wp-includes/media.php b/wp-includes/media.php
new file mode 100644
index 0000000..742b1bc
--- /dev/null
+++ b/wp-includes/media.php
@@ -0,0 +1,404 @@
+<?php
+
+// functions for media display
+
+// scale down the default size of an image so it's a better fit for the editor and theme
+function image_constrain_size_for_editor($width, $height, $size = 'medium') {
+
+ if ( is_array($size) ) {
+ $max_width = $size[0];
+ $max_height = $size[1];
+ }
+ elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
+ $max_width = intval(get_option('thumbnail_size_w'));
+ $max_height = intval(get_option('thumbnail_size_h'));
+ // last chance thumbnail size defaults
+ if ( !$max_width && !$max_height ) {
+ $max_width = 128;
+ $max_height = 96;
+ }
+ }
+ elseif ( $size == 'medium' ) {
+ $max_width = intval(get_option('medium_size_w'));
+ $max_height = intval(get_option('medium_size_h'));
+ // if no width is set, default to the theme content width if available
+ }
+ else { // $size == 'full'
+ // we're inserting a full size image into the editor. if it's a really big image we'll scale it down to fit reasonably
+ // within the editor itself, and within the theme's content width if it's known. the user can resize it in the editor
+ // if they wish.
+ if ( !empty($GLOBALS['content_width']) ) {
+ $max_width = $GLOBALS['content_width'];
+ }
+ else
+ $max_width = 500;
+ }
+
+ list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size );
+
+ return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
+}
+
+// return a width/height string for use in an <img /> tag. Empty values will be omitted.
+function image_hwstring($width, $height) {
+ $out = '';
+ if ($width)
+ $out .= 'width="'.intval($width).'" ';
+ if ($height)
+ $out .= 'height="'.intval($height).'" ';
+ return $out;
+}
+
+// Scale an image to fit a particular size (such as 'thumb' or 'medium'), and return an image URL, height and width.
+// The URL might be the original image, or it might be a resized version. This function won't create a new resized copy, it will just return an already resized one if it exists.
+// returns an array($url, $width, $height)
+function image_downsize($id, $size = 'medium') {
+
+ if ( !wp_attachment_is_image($id) )
+ return false;
+
+ $img_url = wp_get_attachment_url($id);
+ $meta = wp_get_attachment_metadata($id);
+ $width = $height = 0;
+
+ // plugins can use this to provide resize services
+ if ( $out = apply_filters('image_downsize', false, $id, $size) )
+ return $out;
+
+ // try for a new style intermediate size
+ if ( $intermediate = image_get_intermediate_size($id, $size) ) {
+ $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
+ $width = $intermediate['width'];
+ $height = $intermediate['height'];
+ }
+ elseif ( $size == 'thumbnail' ) {
+ // fall back to the old thumbnail
+ if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize($thumb_file) ) {
+ $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
+ $width = $info[0];
+ $height = $info[1];
+ }
+ }
+ if ( !$width && !$height && isset($meta['width'], $meta['height']) ) {
+ // any other type: use the real image and constrain it
+ list( $width, $height ) = image_constrain_size_for_editor( $meta['width'], $meta['height'], $size );
+ }
+
+ if ( $img_url)
+ return array( $img_url, $width, $height );
+ return false;
+
+}
+
+// return an <img src /> tag for the given image attachment, scaling it down if requested
+function get_image_tag($id, $alt, $title, $align, $rel = false, $size='medium') {
+
+ list( $img_src, $width, $height ) = image_downsize($id, $size);
+ $hwstring = image_hwstring($width, $height);
+
+ $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />';
+
+ $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
+
+ return $html;
+}
+
+// same as wp_shrink_dimensions, except the max parameters are optional.
+// if either width or height are empty, no constraint is applied on that dimension.
+function wp_constrain_dimensions( $current_width, $current_height, $max_width=0, $max_height=0 ) {
+ if ( !$max_width and !$max_height )
+ return array( $current_width, $current_height );
+
+ $width_ratio = $height_ratio = 1.0;
+
+ if ( $max_width > 0 && $current_width > $max_width )
+ $width_ratio = $max_width / $current_width;
+
+ if ( $max_height > 0 && $current_height > $max_height )
+ $height_ratio = $max_height / $current_height;
+
+ // the smaller ratio is the one we need to fit it to the constraining box
+ $ratio = min( $width_ratio, $height_ratio );
+
+ return array( intval($current_width * $ratio), intval($current_height * $ratio) );
+}
+
+// calculate dimensions and coordinates for a resized image that fits within a specified width and height
+// if $crop is true, the largest matching central portion of the image will be cropped out and resized to the required size
+function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=false) {
+
+ if ($orig_w <= 0 || $orig_h <= 0)
+ return false;
+ // at least one of dest_w or dest_h must be specific
+ if ($dest_w <= 0 && $dest_h <= 0)
+ return false;
+
+ if ( $crop ) {
+ // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
+ $aspect_ratio = $orig_w / $orig_h;
+ $new_w = min($dest_w, $orig_w);
+ $new_h = min($dest_h, $orig_h);
+ if (!$new_w) {
+ $new_w = intval($new_h * $aspect_ratio);
+ }
+ if (!$new_h) {
+ $new_h = intval($new_w / $aspect_ratio);
+ }
+
+ $size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
+
+ $crop_w = ceil($new_w / $size_ratio);
+ $crop_h = ceil($new_h / $size_ratio);
+
+ $s_x = floor(($orig_w - $crop_w)/2);
+ $s_y = floor(($orig_h - $crop_h)/2);
+ }
+ else {
+ // don't crop, just resize using $dest_w x $dest_h as a maximum bounding box
+ $crop_w = $orig_w;
+ $crop_h = $orig_h;
+
+ $s_x = 0;
+ $s_y = 0;
+
+ list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
+ }
+
+ // if the resulting image would be the same size or larger we don't want to resize it
+ if ($new_w >= $orig_w && $new_h >= $orig_h)
+ return false;
+
+ // the return array matches the parameters to imagecopyresampled()
+ // int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
+ return array(0, 0, $s_x, $s_y, $new_w, $new_h, $crop_w, $crop_h);
+
+}
+
+// Scale down an image to fit a particular size and save a new copy of the image
+function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=75) {
+
+ $image = wp_load_image( $file );
+ if ( !is_resource( $image ) )
+ return new WP_Error('error_loading_image', $image);
+
+ list($orig_w, $orig_h, $orig_type) = getimagesize( $file );
+ $dims = image_resize_dimensions($orig_w, $orig_h, $max_w, $max_h, $crop);
+ if (!$dims)
+ return $dims;
+ list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims;
+
+ $newimage = imagecreatetruecolor( $dst_w, $dst_h);
+
+ // preserve PNG transparency
+ if ( IMAGETYPE_PNG == $orig_type && function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
+ imagealphablending( $newimage, false);
+ imagesavealpha( $newimage, true);
+ }
+
+ imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
+
+ // we don't need the original in memory anymore
+ imagedestroy( $image );
+
+ // $suffix will be appended to the destination filename, just before the extension
+ if ( !$suffix )
+ $suffix = "{$dst_w}x{$dst_h}";
+
+ $info = pathinfo($file);
+ $dir = $info['dirname'];
+ $ext = $info['extension'];
+ $name = basename($file, ".{$ext}");
+ if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) )
+ $dir = $_dest_path;
+ $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
+
+ if ( $orig_type == IMAGETYPE_GIF ) {
+ if (!imagegif( $newimage, $destfilename ) )
+ return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
+ }
+ elseif ( $orig_type == IMAGETYPE_PNG ) {
+ if (!imagepng( $newimage, $destfilename ) )
+ return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
+ }
+ else {
+ // all other formats are converted to jpg
+ $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
+ if (!imagejpeg( $newimage, $destfilename, $jpeg_quality ) )
+ return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
+ }
+
+ imagedestroy( $newimage );
+
+ // Set correct file permissions
+ $stat = stat( dirname( $destfilename ));
+ $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
+ @ chmod( $destfilename, $perms );
+
+ return $destfilename;
+}
+
+// resize an image to make a thumbnail or intermediate size, and return metadata describing the new copy
+// returns false if no image was created
+function image_make_intermediate_size($file, $width, $height, $crop=false) {
+ if ( $width || $height ) {
+ $resized_file = image_resize($file, $width, $height, $crop);
+ if ( !is_wp_error($resized_file) && $resized_file && $info = getimagesize($resized_file) ) {
+ return array(
+ 'file' => basename( $resized_file ),
+ 'width' => $info[0],
+ 'height' => $info[1],
+ );
+ }
+ }
+ return false;
+}
+
+function image_get_intermediate_size($post_id, $size='thumbnail') {
+ if ( !$imagedata = wp_get_attachment_metadata( $post_id ) )
+ return false;
+
+ // get the best one for a specified set of dimensions
+ if ( is_array($size) && !empty($imagedata['sizes']) ) {
+ foreach ( $imagedata['sizes'] as $_size => $data ) {
+ // already cropped to width or height; so use this size
+ if ( ( $data['width'] == $size[0] && $data['height'] <= $size[1] ) || ( $data['height'] == $size[1] && $data['width'] <= $size[0] ) ) {
+ $file = $data['file'];
+ list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
+ return compact( 'file', 'width', 'height' );
+ }
+ // add to lookup table: area => size
+ $areas[$data['width'] * $data['height']] = $_size;
+ }
+ if ( !$size || !empty($areas) ) {
+ // find for the smallest image not smaller than the desired size
+ ksort($areas);
+ foreach ( $areas as $_size ) {
+ $data = $imagedata['sizes'][$_size];
+ if ( $data['width'] >= $size[0] || $data['height'] >= $size[1] ) {
+ $file = $data['file'];
+ list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
+ return compact( 'file', 'width', 'height' );
+ }
+ }
+ }
+ }
+
+ if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) )
+ return false;
+
+ $data = $imagedata['sizes'][$size];
+ // include the full filesystem path of the intermediate file
+ if ( empty($data['path']) && !empty($data['file']) ) {
+ $file_url = wp_get_attachment_url($post_id);
+ $data['path'] = path_join( dirname($imagedata['file']), $data['file'] );
+ $data['url'] = path_join( dirname($file_url), $data['file'] );
+ }
+ return $data;
+}
+
+// get an image to represent an attachment - a mime icon for files, thumbnail or intermediate size for images
+// returns an array (url, width, height), or false if no image is available
+function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) {
+
+ // get a thumbnail or intermediate image if there is one
+ if ( $image = image_downsize($attachment_id, $size) )
+ return $image;
+
+ if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
+ $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
+ $src_file = $icon_dir . '/' . basename($src);
+ @list($width, $height) = getimagesize($src_file);
+ }
+ if ( $src && $width && $height )
+ return array( $src, $width, $height );
+ return false;
+}
+
+// as per wp_get_attachment_image_src, but returns an <img> tag
+function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = false) {
+
+ $html = '';
+ $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
+ if ( $image ) {
+ list($src, $width, $height) = $image;
+ $hwstring = image_hwstring($width, $height);
+ if ( is_array($size) )
+ $size = join('x', $size);
+ $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" />';
+ }
+
+ return $html;
+}
+
+add_shortcode('gallery', 'gallery_shortcode');
+
+function gallery_shortcode($attr) {
+ global $post;
+
+ // Allow plugins/themes to override the default gallery template.
+ $output = apply_filters('post_gallery', '', $attr);
+ if ( $output != '' )
+ return $output;
+
+ $attachments = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\"");
+
+ if ( empty($attachments) )
+ return '';
+
+ $output = apply_filters('gallery_style', "
+ <style type='text/css'>
+ .gallery {
+ margin: auto;
+ }
+ .gallery div {
+ float: left;
+ margin-top: 10px;
+ text-align: center;
+ width: 33%; }
+ .gallery img {
+ border: 2px solid #cfcfcf;
+ }
+ </style>
+ <div class='gallery'>");
+
+ foreach ( $attachments as $id => $attachment ) {
+ $link = wp_get_attachment_link($id, 'thumbnail', true);
+ $output .= "
+ <div>
+ $link
+ </div>";
+ if ( ++$i % 3 == 0 )
+ $output .= '<br style="clear: both" />';
+ }
+
+ $output .= "
+ <br style='clear: both;' >
+ </div>\n";
+
+ return $output;
+}
+
+function previous_image_link() {
+ adjacent_image_link(true);
+}
+
+function next_image_link() {
+ adjacent_image_link(false);
+}
+
+function adjacent_image_link($prev = true) {
+ global $post;
+ $post = get_post($post);
+ $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\""));
+
+ foreach ( $attachments as $k => $attachment )
+ if ( $attachment->ID == $post->ID )
+ break;
+
+ $k = $prev ? $k - 1 : $k + 1;
+
+ if ( isset($attachments[$k]) )
+ echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);
+}
+
+?>
diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php
new file mode 100644
index 0000000..7e3bf44
--- /dev/null
+++ b/wp-includes/shortcodes.php
@@ -0,0 +1,133 @@
+<?php
+
+/*
+
+An API for creating shortcode tags that support attributes and enclosed content, such as:
+
+[shortcode /]
+[shortcode foo="bar" baz="bing" /]
+[shortcode foo="bar"]content[/shortcode]
+
+tag and attrbute parsing regexp code based on the Textpattern tag parser.
+
+To apply shortcode tags to content:
+
+$out = do_shortcode($content);
+
+Simplest example of a shortcode tag using the API:
+
+// [footag foo="bar"]
+function footag_func($atts) {
+ return "foo = {$atts[foo]}";
+}
+add_shortcode('footag', 'footag_func');
+
+Example with nice attribute defaults:
+
+// [bartag foo="bar"]
+function bartag_func($atts) {
+ extract(shortcode_atts(array(
+ 'foo' => 'no foo',
+ 'baz' => 'default baz',
+ ), $atts));
+
+ return "foo = {$foo}";
+}
+add_shortcode('bartag', 'bartag_func');
+
+Example with enclosed content:
+
+// [baztag]content[/baztag]
+function baztag_func($atts, $content='') {
+ return "content = $content";
+}
+add_shortcode('baztag', 'baztag_func');
+
+*/
+
+$shortcode_tags = array();
+
+function add_shortcode($tag, $func) {
+ global $shortcode_tags;
+
+ if ( is_callable($func) )
+ $shortcode_tags[$tag] = $func;
+}
+
+function remove_shortcode($tag) {
+ global $shortcode_tags;
+
+ unset($shortcode_tags[$tag]);
+}
+
+function remove_all_shortcodes() {
+ global $shortcode_tags;
+
+ $shortcode_tags = array();
+}
+
+function do_shortcode($content) {
+ global $shortcode_tags;
+
+ if (empty($shortcode_tags) || !is_array($shortcode_tags))
+ return $content;
+
+ $tagnames = array_keys($shortcode_tags);
+ $tagregexp = join( '|', array_map('preg_quote', $tagnames) );
+
+ $pattern = '/\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?/s';
+
+ return preg_replace_callback($pattern, 'do_shortcode_tag', $content);
+}
+
+function do_shortcode_tag($m) {
+ global $shortcode_tags;
+
+ $tag = $m[1];
+ $attr = shortcode_parse_atts($m[2]);
+
+ if ( isset($m[4]) ) {
+ // enclosing tag - extra parameter
+ return call_user_func($shortcode_tags[$tag], $attr, $m[4]);
+ } else {
+ // self-closing tag
+ return call_user_func($shortcode_tags[$tag], $attr);
+ }
+}
+
+function shortcode_parse_atts($text) {
+ $atts = array();
+ $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
+ if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {
+ foreach ($match as $m) {
+ if (!empty($m[1]))
+ $atts[strtolower($m[1])] = stripcslashes($m[2]);
+ elseif (!empty($m[3]))
+ $atts[strtolower($m[3])] = stripcslashes($m[4]);
+ elseif (!empty($m[5]))
+ $atts[strtolower($m[5])] = stripcslashes($m[6]);
+ elseif (isset($m[7]) and strlen($m[7]))
+ $atts[] = stripcslashes($m[7]);
+ elseif (isset($m[8]))
+ $atts[] = stripcslashes($m[8]);
+ }
+ } else {
+ $atts = ltrim($text);
+ }
+ return $atts;
+}
+
+function shortcode_atts($pairs, $atts) {
+ $out = array();
+ foreach($pairs as $name => $default) {
+ if ( array_key_exists($name, $atts) )
+ $out[$name] = $atts[$name];
+ else
+ $out[$name] = $default;
+ }
+ return $out;
+}
+
+add_filter('the_content', 'do_shortcode');
+
+?>